Commit 9bb2598f authored by Julien Jehannet's avatar Julien Jehannet
Browse files

[pkginfo] upgrade to new setup.py + fix lgp warnings

parent 73e1da9eb1eb
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......@@ -20,16 +20,15 @@
modname = "mtconverter"
distname = "logilab-mtconverter"
subpackage_of = 'logilab'
numversion = (0, 8, 2)
version = '.'.join([str(num) for num in numversion])
license = 'LGPL'
web = "http://www.logilab.org/project/%s" % distname
ftp = "ftp://ftp.logilab.org/pub/%s" % modname
mailinglist = "mailto://python-projects@lists.logilab.org"
description = "a library to convert from a MIME type to another"
author = "Sylvain Thenault"
author_email = "contact@logilab.fr"
short_desc = "a library to convert from a MIME type to another"
long_desc = """This package is originally a backport of Zope's PortalTransforms tool with
all Zope's internal removed (e.g. most of the code).
"""
web = "http://www.logilab.org/project/logilab-mtconverter"
......@@ -54,13 +54,13 @@ logilab-mtconverter (0.6.0-2) unstable; urgency=low
-- Sylvain Thénault <sylvain.thenault@logilab.fr> Wed, 25 Mar 2009 09:55:21 +0100
logilab-mtconverter (0.6.0-1) DISTRIBUTION; urgency=low
logilab-mtconverter (0.6.0-1) unstable; urgency=low
* new upstream release
-- Aurélien Campéas <aurelien.campeas@logilab.fr> Thu, 12 Feb 2009 17:19:00 +0100
logilab-mtconverter (0.5.0-1) DISTRIBUTION; urgency=low
logilab-mtconverter (0.5.0-1) unstable; urgency=low
* new upstream release
......
......@@ -11,7 +11,7 @@ Architecture: all
Depends: ${python:Depends}
Suggests: python-imaging, python-pygments, pdftotext, lynx, python-chardet
XB-Python-Version: ${python:Versions}
Homepage: http://www.logilab.org/projects/mtconverter
Homepage: http://www.logilab.org/project/mtconverter
Description: a library to convert from a MIME type to another
This package originally a backport of Zope's PortalTransforms tool with
all Zope's internal removed (e.g. most of the code).
......
......@@ -7,7 +7,7 @@ Upstream Author:
Copyright:
Copyright (c) 2006-2010 LOGILAB S.A. (Paris, FRANCE).
Copyright (c) 2006-2011 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr/ -- mailto:contact@logilab.fr
License:
......
......@@ -5,7 +5,7 @@
# adapted by Logilab for automatic generation by debianize
# (part of the devtools project, http://www.logilab.org/projects/devtools)
#
# Copyright (c) 2003-2005 LOGILAB S.A. (Paris, FRANCE).
# Copyright (c) 2003-2011 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
# Uncomment this to turn on verbose mode.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
#!/usr/bin/env python
# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# -*- coding: utf-8 -*-
# pylint: disable=W0404,W0622,W0704,W0613
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......@@ -18,14 +19,13 @@
# You should have received a copy of the GNU Lesser General Public License along
# with logilab-mtconverter. If not, see <http://www.gnu.org/licenses/>.
"""Generic Setup script, takes package info from __pkginfo__.py file.
"""
__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'):
......@@ -38,50 +38,40 @@ except ImportError:
from distutils.command import install_lib
USE_SETUPTOOLS = 0
try:
# python3
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
# python2.x
from distutils.command.build_py import build_py
sys.modules.pop('__pkginfo__', None)
# import optional features
__pkginfo__ = __import__("__pkginfo__")
# import required features
from __pkginfo__ import modname, version, license, short_desc, long_desc, \
from __pkginfo__ import modname, version, license, description, \
web, author, author_email
# import optional features
try:
from __pkginfo__ import distname
except ImportError:
distname = modname
try:
from __pkginfo__ import scripts
except ImportError:
scripts = []
try:
from __pkginfo__ import data_files
except ImportError:
data_files = None
try:
from __pkginfo__ import subpackage_of
except ImportError:
subpackage_of = None
try:
from __pkginfo__ import include_dirs
except ImportError:
include_dirs = []
try:
from __pkginfo__ import ext_modules
except ImportError:
ext_modules = None
try:
from __pkginfo__ import install_requires
except ImportError:
install_requires = None
distname = getattr(__pkginfo__, 'distname', modname)
scripts = getattr(__pkginfo__, 'scripts', [])
data_files = getattr(__pkginfo__, 'data_files', None)
subpackage_of = getattr(__pkginfo__, 'subpackage_of', None)
include_dirs = getattr(__pkginfo__, 'include_dirs', [])
ext_modules = getattr(__pkginfo__, 'ext_modules', None)
install_requires = getattr(__pkginfo__, 'install_requires', None)
dependency_links = getattr(__pkginfo__, 'dependency_links', [])
STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
if exists('README'):
long_description = open('README').read()
else:
long_description = ''
def ensure_scripts(linux_scripts):
"""
Creates the proper script names required for each platform
"""Creates the proper script names required for each platform
(taken from 4Suite)
"""
from distutils import util
......@@ -91,10 +81,8 @@ def ensure_scripts(linux_scripts):
scripts_ = linux_scripts
return scripts_
def get_packages(directory, prefix):
"""return a list of subpackages for the given directory
"""
"""return a list of subpackages for the given directory"""
result = []
for package in os.listdir(directory):
absfile = join(directory, package)
......@@ -108,48 +96,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:
......@@ -179,15 +126,17 @@ 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"""
try:
if USE_SETUPTOOLS:
if USE_SETUPTOOLS:
if '--force-manifest' in sys.argv:
sys.argv.remove('--force-manifest')
except:
pass
# install-layout option was introduced in 2.5.3-1~exp1
elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv:
sys.argv.remove('--install-layout=deb')
if subpackage_of:
package = subpackage_of + '.' + modname
kwargs['package_dir'] = {package : '.'}
......@@ -199,19 +148,21 @@ def install(**kwargs):
packages = [modname] + get_packages(os.getcwd(), modname)
if USE_SETUPTOOLS and install_requires:
kwargs['install_requires'] = install_requires
kwargs['dependency_links'] = dependency_links
kwargs['packages'] = packages
return setup(name = distname,
version = version,
license = license,
description = short_desc,
long_description = long_desc,
description = description,
long_description = long_description,
author = author,
author_email = author_email,
url = web,
scripts = ensure_scripts(scripts),
data_files = data_files,
ext_modules = ext_modules,
cmdclass = {'install_lib': MyInstallLib},
cmdclass = {'install_lib': MyInstallLib,
'build_py': build_py},
**kwargs
)
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# -*- coding: iso-8859-1 -*-
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# -*- coding: utf-8 -*-
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
......@@ -10,7 +10,7 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
......@@ -10,7 +10,7 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
# copyright 2006-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-mtconverter.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment