From e00841cdc04c0d74cb45e8b6d8b009f761fa354c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org>
Date: Sat, 27 Nov 2010 21:25:58 +0100
Subject: [PATCH 5/7] use dh_python2 instead of dh_pysupport

---
 stdeb/command/common.py |    8 --------
 stdeb/util.py           |   39 +++++++++++++++------------------------
 2 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/stdeb/command/common.py b/stdeb/command/common.py
index 0cfc770..e212104 100644
--- a/stdeb/command/common.py
+++ b/stdeb/command/common.py
@@ -96,7 +96,6 @@ class common_debian_package_command(Command):
         except DistutilsModuleError, err:
             use_setuptools = False
 
-        install_requires = ()
         have_script_entry_points = None
 
         config_fname = 'stdeb.cfg'
@@ -119,12 +118,6 @@ class common_debian_package_command(Command):
             egg_module_name = egg_info_dirname[:egg_info_dirname.index('.egg-info')]
             egg_module_name = egg_module_name.split(os.sep)[-1]
 
-            try:
-                if not self.ignore_install_requires:
-                    install_requires = open(os.path.join(egg_info_dirname,'requires.txt'),'rU').read()
-            except EnvironmentError:
-                pass
-
             if 1:
                 # determine whether script specifies setuptools entry_points
                 ep_fname = os.path.join(egg_info_dirname,'entry_points.txt')
@@ -167,7 +160,6 @@ class common_debian_package_command(Command):
             long_description = self.distribution.get_long_description(),
             patch_file = self.patch_file,
             patch_level = self.patch_level,
-            install_requires = install_requires,
             debian_version = self.debian_version,
             force_buildsystem=self.force_buildsystem,
             have_script_entry_points = have_script_entry_points,
diff --git a/stdeb/util.py b/stdeb/util.py
index 27a2941..e036f8b 100644
--- a/stdeb/util.py
+++ b/stdeb/util.py
@@ -22,10 +22,7 @@ __all__ = ['DebianInfo','build_dsc','expand_tarball','expand_zip',
 DH_MIN_VERS = '7'       # Fundamental to stdeb >= 0.4
 DH_IDEAL_VERS = '7.4.3' # fixes Debian bug 548392
 
-PYSUPPORT_MIN_VERS = '0.8.4' # Namespace package support was added
-                             # sometime between 0.7.5ubuntu1 and
-                             # 0.8.4lenny1 (Lenny). Might be able to
-                             # back this down.
+PYTHON_ALL_MIN_VERS = '2.6.6-3'
 
 import exceptions
 class CalledProcessError(exceptions.Exception): pass
@@ -636,7 +633,6 @@ class DebianInfo:
                  long_description=NotGiven,
                  patch_file=None,
                  patch_level=None,
-                 install_requires=None,
                  setup_requires=None,
                  debian_version=None,
                  force_buildsystem=None,
@@ -738,10 +734,11 @@ class DebianInfo:
 
         if has_ext_modules:
             self.architecture = 'any'
+            build_deps.append('python-all-dev (>= %s)'%PYTHON_ALL_MIN_VERS)
             depends.append('${shlibs:Depends}')
-            build_deps.append('python-all-dev')
         else:
             self.architecture = 'all'
+            build_deps.append('python-all (>= %s)'%PYTHON_ALL_MIN_VERS)
 
         self.copyright_file = parse_val(cfg,module_name,'Copyright-File')
         self.mime_file = parse_val(cfg,module_name,'MIME-File')
@@ -768,9 +765,6 @@ class DebianInfo:
                 '%s usr/share/applications'%mime_desktop_file)
 
         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))
         self.depends = ', '.join(depends)
 
         self.debian_section = parse_val(cfg,module_name,'Section')
@@ -794,8 +788,6 @@ class DebianInfo:
         else:
             build_deps.append( 'debhelper (>= %s)'%DH_MIN_VERS )
 
-        build_deps.append('python-support (>= %s)'%PYSUPPORT_MIN_VERS)
-
         build_deps.extend( parse_vals(cfg,module_name,'Build-Depends') )
         self.build_depends = ', '.join(build_deps)
 
@@ -911,7 +903,7 @@ XB-Python-Version: ${python:Versions}
 
         self.dirlist = ""
 
-        sequencer_options = []
+        sequencer_options = ['--with python2']
         if force_buildsystem:
             sequencer_options.append('--buildsystem=python_distutils')
         self.sequencer_options = ' '.join(sequencer_options)
@@ -1173,7 +1165,7 @@ def build_dsc(debinfo,
             shutil.rmtree(tmp_dir)
 
     if 1:
-        # check versions of debhelper and python-support
+        # check versions of debhelper and python-all
         debhelper_version_str = get_version_str('debhelper')
         if len(debhelper_version_str)==0:
             log.warn('This version of stdeb requires debhelper >= %s, but you '
@@ -1187,18 +1179,18 @@ def build_dsc(debinfo,
                          'compatible with older versions of debhelper.'%(
                     DH_MIN_VERS,))
 
-        pysupport_version_str = get_version_str('python-support')
-        if len(pysupport_version_str)==0:
-            log.warn('This version of stdeb requires python-support >= %s, '
-                     'but you do not have python-support installed. '
-                     'Could not check compatibility.'%PYSUPPORT_MIN_VERS)
+        python_defaults_version_str = get_version_str('python-all')
+        if len(python_defaults_version_str)==0:
+            log.warn('This version of stdeb requires python-all >= %s, '
+                     'but you do not have this package installed. '
+                     'Could not check compatibility.'%PYTHON_ALL_MIN_VERS)
         else:
             if not dpkg_compare_versions(
-                pysupport_version_str, 'ge', PYSUPPORT_MIN_VERS ):
-                log.warn('This version of stdeb requires python-support >= %s. '
-                         'Use stdeb 0.3.x to generate source packages '
-                         'compatible with older versions of python-support.'%(
-                    PYSUPPORT_MIN_VERS,))
+                python_defaults_version_str, 'ge', PYTHON_ALL_MIN_VERS):
+                log.warn('This version of stdeb requires python-all >= %s. '
+                         'Use stdeb 0.6.0 or older to generate source packages '
+                         'that use python-support.'%(
+                    PYTHON_ALL_MIN_VERS,))
 
     #    D. restore debianized tree
     os.rename(fullpath_repackaged_dirname+'.debianized',
@@ -1245,7 +1237,6 @@ RULES_MAIN = """\
 
 # This file was automatically generated by stdeb %(stdeb_version)s at
 # %(date822)s
-
 %(exports)s
 
 %(percent_symbol)s:
-- 
1.7.2.3

