Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide --guess-depends-package-name=True option #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
description='Python to Debian source package conversion utility',
Expand Down
2 changes: 1 addition & 1 deletion stdeb/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 4 additions & 0 deletions stdeb/command/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
37 changes: 27 additions & 10 deletions stdeb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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')
Expand Down