diff --git a/setup.py b/setup.py index c8bbe812..479c1e09 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup(name='stdeb', # Keep version in sync with stdeb/__init__.py, Install section # of README.rst, and USER_AGENT in scripts/pypi-install. - version='0.6.0', + version='0.6.0.2', author='Andrew Straw', author_email='strawman@astraw.com', description='Python to Debian source package conversion utility', diff --git a/stdeb/__init__.py b/stdeb/__init__.py index 76dff219..7098830a 100644 --- a/stdeb/__init__.py +++ b/stdeb/__init__.py @@ -1,5 +1,5 @@ import logging -__version__ = '0.6.0' # keep in sync with ../setup.py +__version__ = '0.6.0.2' # keep in sync with ../setup.py log = logging.getLogger('stdeb') log.setLevel(logging.INFO) diff --git a/stdeb/command/common.py b/stdeb/command/common.py index cfadd58e..126b60a9 100644 --- a/stdeb/command/common.py +++ b/stdeb/command/common.py @@ -23,6 +23,8 @@ def initialize_options (self): self.force_buildsystem = None self.no_backwards_compatibility = None self.guess_conflicts_provides_replaces = None + self.guess_depends_package_name = None + self.suppress_packaging_version = None # deprecated options self.default_distribution = None @@ -204,6 +206,8 @@ def get_debinfo(self): setup_requires = (), # XXX How do we get the setup_requires? use_setuptools = use_setuptools, guess_conflicts_provides_replaces=self.guess_conflicts_provides_replaces, + guess_depends_package_name=self.guess_depends_package_name, + suppress_packaging_version=self.suppress_packaging_version, sdist_dsc_command = self, ) return debinfo diff --git a/stdeb/util.py b/stdeb/util.py index 713d5490..72ce723f 100644 --- a/stdeb/util.py +++ b/stdeb/util.py @@ -79,6 +79,12 @@ def check_call(*popenargs, **kwargs): ('guess-conflicts-provides-replaces=',None, 'If True, attempt to guess Conflicts/Provides/Replaces in debian/control ' 'based on apt-cache output. (Default=False).'), + ('guess-depends-package-name=',None, + 'If True, attempt to guess Depends in debian/control ' + 'based on setup.py install_requires package names. (Default=False).'), + ('suppress-packaging-version=',None, + 'Do not append packaging version (-number) to setup.py version when ' + 'generating Debian package version. (Default=False). '), ] # old entries from stdeb.cfg: @@ -645,6 +651,8 @@ def __init__(self, pycentral_backwards_compatibility=None, use_setuptools = False, guess_conflicts_provides_replaces = False, + guess_depends_package_name = False, + suppress_packaging_version = False, sdist_dsc_command = None, ): if cfg_files is NotGiven: raise ValueError("cfg_files must be supplied") @@ -712,17 +720,24 @@ def __init__(self, self.epoch = parse_val(cfg,module_name,'Epoch') if self.epoch != '' and not self.epoch.endswith(':'): self.epoch = self.epoch + ':' - self.packaging_version = parse_val(cfg,module_name,'Debian-Version') - if debian_version is not None: - # command-line arg overrides file - self.packaging_version = debian_version - self.dsc_version = '%s-%s'%( + + if suppress_packaging_version: + version_suffix = '' + else: + self.packaging_version = parse_val(cfg, module_name, + 'Debian-Version') + if debian_version is not None: + # command-line arg overrides file + self.packaging_version = debian_version + version_suffix = '-%s' % self.packaging_version + + self.dsc_version = '%s%s'%( self.upstream_version, - self.packaging_version) - self.full_version = '%s%s-%s'%( + version_suffix) + self.full_version = '%s%s%s'%( self.epoch, self.upstream_version, - self.packaging_version) + version_suffix) self.distname = parse_val(cfg,module_name,'Suite') self.maintainer = ', '.join(parse_vals(cfg,module_name,'Maintainer')) self.uploaders = parse_vals(cfg,module_name,'Uploaders') @@ -733,7 +748,8 @@ def __init__(self, build_deps.append('python-setuptools (>= 0.6b3)') if setup_requires is not None and len(setup_requires): build_deps.extend( - get_deb_depends_from_setuptools_requires(setup_requires)) + get_deb_depends_from_setuptools_requires(setup_requires, + 'guess' if guess_depends_package_name else 'warn')) depends = ['${misc:Depends}', '${python:Depends}'] need_custom_binary_target = False @@ -774,7 +790,8 @@ def __init__(self, depends.extend(parse_vals(cfg,module_name,'Depends') ) if install_requires is not None and len(install_requires): depends.extend(get_deb_depends_from_setuptools_requires( - install_requires)) + install_requires, + 'guess' if guess_depends_package_name else 'warn')) self.depends = ', '.join(depends) self.debian_section = parse_val(cfg,module_name,'Section')