diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-10 11:03:56 +0100 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-10 11:03:56 +0100 |
commit | c72f207e790f648ceba798b2c421e3216e8b3431 (patch) | |
tree | 2f228f160828242b6d046edc4a6c55a0253f1fdf | |
parent | c715026e96f653306b2a45754d2d5d4e186c25a7 (diff) | |
download | logilab-common-c72f207e790f648ceba798b2c421e3216e8b3431.tar.gz |
packaging : add py3k target; update setup.py and other files to make py3k packaging work
-rw-r--r-- | __pkginfo__.py | 1 | ||||
-rw-r--r-- | debian.py3k/control | 39 | ||||
-rwxr-xr-x | debian.py3k/rules | 91 | ||||
-rw-r--r-- | debian.py3k/source/format | 1 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | setup.py | 51 |
6 files changed, 138 insertions, 47 deletions
diff --git a/__pkginfo__.py b/__pkginfo__.py index d8de687..6c7797e 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -38,7 +38,6 @@ author_email = "contact@logilab.fr" from os.path import join scripts = [join('bin', 'pytest')] include_dirs = [join('test', 'data')] -pyversions = ['2.4', '2.5', '2.6'] install_requires = ['unittest2 >= 0.5.1'] diff --git a/debian.py3k/control b/debian.py3k/control new file mode 100644 index 0000000..6a873bf --- /dev/null +++ b/debian.py3k/control @@ -0,0 +1,39 @@ +Source: logilab-common +Section: python +Priority: optional +Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> +Uploaders: David Douard <david.douard@logilab.fr>, + Alexandre Fayolle <afayolle@debian.org>, + Sandro Tosi <morph@debian.org>, + Adrien Di Mascio <Adrien.DiMascio@logilab.fr>, + Nicolas Chauvat <nicolas.chauvat@logilab.fr>, + Julien Jehannet <julien.jehannet@debian.org>, +Build-Depends: debhelper (>= 5.0.38), python3 +Build-Depends-Indep: python-support, python-epydoc, graphviz, python-egenix-mxdatetime, python-unittest2 +XS-Python-Version: >= 3 +Standards-Version: 3.9.1 +Homepage: http://www.logilab.org/project/logilab-common +Vcs-Svn: svn://svn.debian.org/svn/python-modules/packages/logilab-common/trunk/ +Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/logilab-common/trunk/ + +Package: python3-logilab-common +Architecture: all +Provides: ${python:Provides} +Depends: ${python:Depends}, ${misc:Depends} +Suggests: pyro, python-unittest2 +#Recommends: # python3-egenix-mxdatetime +Conflicts: python-constraint ( <= 0.3.0-4), python-logilab-astng ( <= 0.16.0-1), pylint ( << 0.11.0-1), devtools ( <= 0.9.0-1), logilab-doctools ( <= 0.1.6-4), python-logilab-aspects ( <= 0.1.4-2), python2.3-logilab-common, python2.4-logilab-common, cubicweb-server ( << 3.6.0-1) +Description: useful miscellaneous modules used by Logilab projects + logilab-common is a collection of low-level Python packages and modules, + designed to ease: + . + * handling command line options and configuration files + * writing interactive command line tools + * manipulation files and character strings + * interfacing to OmniORB + * generating of SQL queries + * running unit tests + * manipulating tree structures + * accessing RDBMS (currently postgreSQL, MySQL and sqlite) + * generating text and HTML reports + * logging diff --git a/debian.py3k/rules b/debian.py3k/rules new file mode 100755 index 0000000..b1ddceb --- /dev/null +++ b/debian.py3k/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. +# +# adapted by Logilab for automatic generation by debianize +# (part of the devtools project, http://www.logilab.org/projects/devtools) +# +# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE). +# http://www.logilab.fr/ -- mailto:contact@logilab.fr + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +PACKAGE:=$(shell grep Package debian/control | cut -d ' ' -f2) + + +include /usr/share/python/python.mk + +build: build-stamp + +build-stamp: + dh_testdir + + # python module build + 2to3-3.1 -wnv -x import setup.py + NO_SETUPTOOLS=1 python3 setup.py -q build --build-purelib build/lib + + # run tests +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) + # we need this hack because we have to import "logilab.common.pytest" + # but since it's a namespace package, we need to "simulate" it + touch $(CURDIR)/build/lib/logilab/__init__.py + # use the default python version to select the script dir to run the tests + #XXX PYTHONPATH=$(CURDIR)/build/lib/ python3 $(CURDIR)/build/scripts-$(PYDEF)/pytest -t test +endif + + # build doc + $(MAKE) -C doc + rm -f $(CURDIR)/build/lib/logilab/__init__.py + touch build-stamp + + +clean: + dh_testdir + dh_testroot + + # clean doc + $(MAKE) -C doc clean + NO_SETUPTOOLS=1 python setup.py clean + [ ! -d build ] || rm -rf build + find . -name "*.pyc" -delete + dh_clean build-stamp + + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + NO_SETUPTOOLS=1 python3 setup.py -q install --no-compile \ + --root=$(CURDIR)/debian/$(PACKAGE)/ \ + ${py_setup_install_args} + find $(CURDIR)/debian/$(PACKAGE)/usr/lib/python*/*-packages/ ! -path "*/test/*py" -name "*py" -exec 2to3-3.1 -wn {} \; + + # remove test directory + rm -rf debian/$(PACKAGE)/usr/lib/python*/*-packages/logilab/common/test + + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_install -i + dh_pysupport -i + dh_installchangelogs -i ChangeLog + dh_installexamples -i + dh_installdocs -i README doc/apidoc/ + dh_installman -i + dh_link -i + dh_compress -i -X.py -X.ini -X.xml -Xtest/ -Xapidoc/ + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: + +binary: binary-indep +.PHONY: build clean binary binary-indep binary-arch diff --git a/debian.py3k/source/format b/debian.py3k/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian.py3k/source/format @@ -0,0 +1 @@ +3.0 (quilt) @@ -1,3 +1,3 @@ [bdist_rpm] -packager = Sylvain Thénault <sylvain.thenault@logilab.fr> +packager = Sylvain Thenault <sylvain.thenault@logilab.fr> provides = logilab.common @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # pylint: disable=W0404,W0622,W0704,W0613 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr @@ -24,7 +25,7 @@ __docformat__ = "restructuredtext en" import os import sys import shutil -from os.path import isdir, exists, join, walk +from os.path import isdir, exists, join try: if os.environ.get('NO_SETUPTOOLS'): @@ -58,7 +59,7 @@ STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build') IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') if exists('README'): - long_description = file('README').read() + long_description = open('README').read() else: long_description = '' @@ -88,48 +89,7 @@ def get_packages(directory, prefix): result += get_packages(absfile, result[-1]) return result -def export(from_dir, to_dir, - blacklist=STD_BLACKLIST, - ignore_ext=IGNORED_EXTENSIONS, - verbose=True): - """make a mirror of from_dir in to_dir, omitting directories and files - listed in the black list - """ - def make_mirror(arg, directory, fnames): - """walk handler""" - for norecurs in blacklist: - try: - fnames.remove(norecurs) - except ValueError: - pass - for filename in fnames: - # don't include binary files - if filename[-4:] in ignore_ext: - continue - if filename[-1] == '~': - continue - src = join(directory, filename) - dest = to_dir + src[len(from_dir):] - if verbose: - print >> sys.stderr, src, '->', dest - if os.path.isdir(src): - if not exists(dest): - os.mkdir(dest) - else: - if exists(dest): - os.remove(dest) - shutil.copy2(src, dest) - try: - os.mkdir(to_dir) - except OSError, ex: - # file exists ? - import errno - if ex.errno != errno.EEXIST: - raise - walk(from_dir, make_mirror, None) - - -EMPTY_FILE = '''"""generated file, don\'t modify or your data will be lost""" +EMPTY_FILE = '''"""generated file, don't modify or your data will be lost""" try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: @@ -159,7 +119,8 @@ class MyInstallLib(install_lib.install_lib): base = modname for directory in include_dirs: dest = join(self.install_dir, base, directory) - export(directory, dest, verbose=False) + shutil.rmtree(dest, ignore_errors=True) + shutil.copytree(directory, dest) def install(**kwargs): """setup entry point""" |