Replace setuptools_git with a smarter approach

Implement a local egg_info command that only re-generates the
SOURCES.txt file when we need to. That is:

 - If there is no SOURCES.txt, make one
 - If we have run the sdist command, make one

Otherwise, leave well enough alone.

Also, skip doing any git processing if SKIP_GIT_SDIST is specified.

This should mean that consumers of our tarballs should not get screwed
by the need to inject git processing into the sdist.

Change-Id: I163b1c153d030e79b120600a2890edeb49e1fa90
This commit is contained in:
Monty Taylor
2013-05-25 07:58:44 +02:00
parent 344187c8a7
commit d26d43014b
7 changed files with 145 additions and 19 deletions

View File

@@ -77,6 +77,7 @@ try:
except ImportError:
import configparser
from pbr import extra_files
import pbr.hooks
# A simplified RE for this; just checks that the line ends with version
@@ -258,23 +259,9 @@ def cfg_to_args(path='setup.cfg'):
wrap_commands(kwargs)
# Handle the [files]/extra_files option
extra_files = has_get_option(config, 'files', 'extra_files')
if extra_files:
extra_files = split_multiline(extra_files)
# Let's do a sanity check
for filename in extra_files:
if not os.path.exists(filename):
raise DistutilsFileError(
'%s from the extra_files option in setup.cfg does not '
'exist' % filename)
# Unfortunately the only really sensible way to do this is to
# monkey-patch the manifest_maker class
@monkeypatch_method(manifest_maker)
def add_defaults(self, extra_files=extra_files, log=log):
log.info('[pbr] running patched manifest_maker command '
'with extra_files support')
add_defaults._orig(self)
self.filelist.extend(extra_files)
files_extra_files = has_get_option(config, 'files', 'extra_files')
if files_extra_files:
extra_files.set_extra_files(split_multiline(files_extra_files))
finally:
# Perform cleanup if any paths were added to sys.path