[pkg] update to dh9 and dh_python2
authorDavid Douard <david.douard@logilab.fr>
Wed, 22 Jul 2015 17:03:43 +0200
changeset 11653 18939907a115
parent 11652 e95725d7ce90
child 11654 00bec1345a78
[pkg] update to dh9 and dh_python2
debian/compat
debian/control
debian/rules
setup.py
--- a/debian/compat	Thu Jun 25 22:57:15 2015 +0200
+++ b/debian/compat	Wed Jul 22 17:03:43 2015 +0200
@@ -1,1 +1,1 @@
-7
+9
--- a/debian/control	Thu Jun 25 22:57:15 2015 +0200
+++ b/debian/control	Wed Jul 22 17:03:43 2015 +0200
@@ -2,8 +2,10 @@
 Section: web
 Priority: optional
 Maintainer: UNLISH S.A.S. (Montpelliers, FRANCE) <contact@unlish.com>
-Build-Depends: debhelper (>= 7), python (>= 2.6), python-support
-Standards-Version: 3.9.3
+Build-Depends:
+  debhelper (>= 9),
+  python (>= 2.6.6-3),
+Standards-Version: 3.9.6
 XS-Python-Version: >= 2.6
 
 Package: cubicweb-pyramid
--- a/debian/rules	Thu Jun 25 22:57:15 2015 +0200
+++ b/debian/rules	Wed Jul 22 17:03:43 2015 +0200
@@ -1,56 +1,14 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-build: build-arch build-indep
-build-arch:
-	# Nothing to do
-build-indep: build-stamp
-build-stamp:
-	dh_testdir
-	NO_SETUPTOOLS=1 python setup.py -q build
-	touch build-stamp
+export NO_SETUPTOOLS=1
 
-clean:
-	dh_testdir
-	rm -f build-stamp configure-stamp
-	rm -rf build
-	find . -name "*.pyc" -delete
-	dh_clean
+%:
+	dh $@ --with python2
 
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs -i
-	NO_SETUPTOOLS=1 python setup.py -q install --no-compile --prefix=debian/cubicweb-pyramid/usr/
+override_dh_auto_install:
+	dh_auto_install
 	# remove generated .egg-info file
-	rm -rf debian/cubicweb-pyramid/usr/lib/python*
-
+	rm -rf debian/*/usr/lib/python*
 
-# Build architecture-independent files here.
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_install -i
-	dh_installchangelogs -i
-	dh_installexamples -i
-	dh_installdocs -i README
-	dh_installman -i
-	dh_pysupport -i /usr/share/cubicweb
-	dh_link -i
-	dh_compress -i -X.py -X.ini -X.xml -Xtest
-	dh_fixperms -i
-	dh_installdeb -i
-	dh_gencontrol -i
-	dh_md5sums -i
-	dh_builddeb -i
-
-
-# Build architecture-dependent files here.
-binary-arch:
-
-binary: binary-indep
-.PHONY: build clean binary-arch binary-indep binary
+override_dh_python2:
+	dh_python2 -i /usr/share/cubicweb
--- a/setup.py	Thu Jun 25 22:57:15 2015 +0200
+++ b/setup.py	Wed Jul 22 17:03:43 2015 +0200
@@ -1,6 +1,9 @@
 #!/usr/bin/env python
 # pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611
 #
+# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
+#
 # This file is part of CubicWeb pyramid cube.
 #
 # CubicWeb is free software: you can redistribute it and/or modify it under the
@@ -22,7 +25,7 @@
 import os
 import sys
 import shutil
-from os.path import isdir, exists, join, walk
+from os.path import isdir, exists, join, walk, dirname
 
 try:
     if os.environ.get('NO_SETUPTOOLS'):
@@ -36,37 +39,48 @@
     USE_SETUPTOOLS = False
 from distutils.command import install_data
 
-# import required features
-from __pkginfo__ import modname, version, license, description, web, \
-     author, author_email, classifiers
+# load metadata from the __pkginfo__.py file so there is no risk of conflict
+# see https://packaging.python.org/en/latest/single_source_version.html
+base_dir = dirname(__file__)
+
+pkginfo = {}
+with open(join(base_dir, "__pkginfo__.py")) as f:
+    exec(f.read(), pkginfo)
 
-if exists('README'):
-    long_description = file('README').read()
-else:
-    long_description = ''
+    
+# get required metadatas
+modname = pkginfo['modname']
+version = pkginfo['version']
+license = pkginfo['license']
+description = pkginfo['description']
+web = pkginfo['web']
+author = pkginfo['author']
+author_email = pkginfo['author_email']
+classifiers = pkginfo['classifiers']
 
-# import optional features
-import __pkginfo__
+with open(join(base_dir, 'README')) as f:
+    long_description = f.read()
+
+# get optional metadatas
+distname = pkginfo.get('distname', modname)
+scripts = pkginfo.get('scripts', ())
+include_dirs = pkginfo.get('include_dirs', ())
+data_files = pkginfo.get('data_files', None)
+ext_modules = pkginfo.get('ext_modules', None)
+dependency_links = pkginfo.get('dependency_links', ())
+
 if USE_SETUPTOOLS:
     requires = {}
     for entry in ("__depends__",): # "__recommends__"):
-        requires.update(getattr(__pkginfo__, entry, {}))
+        requires.update(pkginfo.get(entry, {}))
     install_requires = [("%s %s" % (d, v and v or "")).strip()
                        for d, v in requires.iteritems()]
 else:
     install_requires = []
 
-distname = getattr(__pkginfo__, 'distname', modname)
-scripts = getattr(__pkginfo__, 'scripts', ())
-include_dirs = getattr(__pkginfo__, 'include_dirs', ())
-data_files = getattr(__pkginfo__, 'data_files', None)
-ext_modules = getattr(__pkginfo__, 'ext_modules', None)
-dependency_links = getattr(__pkginfo__, 'dependency_links', ())
-
-BASE_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
+BASE_BLACKLIST = ('CVS', '.svn', '.hg', '.git', 'debian', 'dist', 'build')
 IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
 
-
 def ensure_scripts(linux_scripts):
     """
     Creates the proper script names required for each platform