setup.py
author Christophe de Vienne <christophe@unlish.com>
Thu, 23 Oct 2014 17:30:15 +0200
changeset 11643 63d2c01fcb94
parent 11642 3defbb0f147a
child 11653 18939907a115
permissions -rw-r--r--
Added tag cubicweb-pyramid-version-0.1.0, cubicweb-pyramid-debian-version-0.1.0-1 for changeset 3defbb0f147a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11632
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     1
#!/usr/bin/env python
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     2
# pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     3
#
11642
3defbb0f147a Prepare release
Christophe de Vienne <christophe@unlish.com>
parents: 11632
diff changeset
     4
# This file is part of CubicWeb pyramid cube.
11632
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     5
#
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
     9
# any later version.
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    10
#
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    14
# details.
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    15
#
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    18
"""Generic Setup script, takes package info from __pkginfo__.py file
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    19
"""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    20
__docformat__ = "restructuredtext en"
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    21
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    22
import os
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    23
import sys
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    24
import shutil
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    25
from os.path import isdir, exists, join, walk
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    26
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    27
try:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    28
    if os.environ.get('NO_SETUPTOOLS'):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    29
        raise ImportError() # do as there is no setuptools
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    30
    from setuptools import setup
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    31
    from setuptools.command import install_lib
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    32
    USE_SETUPTOOLS = True
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    33
except ImportError:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    34
    from distutils.core import setup
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    35
    from distutils.command import install_lib
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    36
    USE_SETUPTOOLS = False
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    37
from distutils.command import install_data
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    38
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    39
# import required features
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    40
from __pkginfo__ import modname, version, license, description, web, \
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    41
     author, author_email, classifiers
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    42
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    43
if exists('README'):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    44
    long_description = file('README').read()
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    45
else:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    46
    long_description = ''
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    47
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    48
# import optional features
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    49
import __pkginfo__
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    50
if USE_SETUPTOOLS:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    51
    requires = {}
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    52
    for entry in ("__depends__",): # "__recommends__"):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    53
        requires.update(getattr(__pkginfo__, entry, {}))
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    54
    install_requires = [("%s %s" % (d, v and v or "")).strip()
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    55
                       for d, v in requires.iteritems()]
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    56
else:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    57
    install_requires = []
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    58
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    59
distname = getattr(__pkginfo__, 'distname', modname)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    60
scripts = getattr(__pkginfo__, 'scripts', ())
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    61
include_dirs = getattr(__pkginfo__, 'include_dirs', ())
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    62
data_files = getattr(__pkginfo__, 'data_files', None)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    63
ext_modules = getattr(__pkginfo__, 'ext_modules', None)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    64
dependency_links = getattr(__pkginfo__, 'dependency_links', ())
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    65
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    66
BASE_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    67
IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    68
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    69
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    70
def ensure_scripts(linux_scripts):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    71
    """
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    72
    Creates the proper script names required for each platform
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    73
    (taken from 4Suite)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    74
    """
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    75
    from distutils import util
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    76
    if util.get_platform()[:3] == 'win':
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    77
        scripts_ = [script + '.bat' for script in linux_scripts]
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    78
    else:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    79
        scripts_ = linux_scripts
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    80
    return scripts_
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    81
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    82
def export(from_dir, to_dir,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    83
           blacklist=BASE_BLACKLIST,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    84
           ignore_ext=IGNORED_EXTENSIONS,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    85
           verbose=True):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    86
    """make a mirror of from_dir in to_dir, omitting directories and files
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    87
    listed in the black list
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    88
    """
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    89
    def make_mirror(arg, directory, fnames):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    90
        """walk handler"""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    91
        for norecurs in blacklist:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    92
            try:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    93
                fnames.remove(norecurs)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    94
            except ValueError:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    95
                pass
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    96
        for filename in fnames:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    97
            # don't include binary files
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    98
            if filename[-4:] in ignore_ext:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
    99
                continue
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   100
            if filename[-1] == '~':
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   101
                continue
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   102
            src = join(directory, filename)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   103
            dest = to_dir + src[len(from_dir):]
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   104
            if verbose:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   105
                sys.stderr.write('%s -> %s\n' % (src, dest))
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   106
            if os.path.isdir(src):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   107
                if not exists(dest):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   108
                    os.mkdir(dest)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   109
            else:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   110
                if exists(dest):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   111
                    os.remove(dest)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   112
                shutil.copy2(src, dest)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   113
    try:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   114
        os.mkdir(to_dir)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   115
    except OSError as ex:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   116
        # file exists ?
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   117
        import errno
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   118
        if ex.errno != errno.EEXIST:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   119
            raise
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   120
    walk(from_dir, make_mirror, None)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   121
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   122
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   123
class MyInstallLib(install_lib.install_lib):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   124
    """extend install_lib command to handle  package __init__.py and
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   125
    include_dirs variable if necessary
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   126
    """
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   127
    def run(self):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   128
        """overridden from install_lib class"""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   129
        install_lib.install_lib.run(self)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   130
        # manually install included directories if any
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   131
        if include_dirs:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   132
            base = modname
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   133
            for directory in include_dirs:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   134
                dest = join(self.install_dir, base, directory)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   135
                export(directory, dest, verbose=False)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   136
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   137
# re-enable copying data files in sys.prefix
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   138
old_install_data = install_data.install_data
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   139
if USE_SETUPTOOLS:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   140
    # overwrite InstallData to use sys.prefix instead of the egg directory
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   141
    class MyInstallData(old_install_data):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   142
        """A class that manages data files installation"""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   143
        def run(self):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   144
            _old_install_dir = self.install_dir
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   145
            if self.install_dir.endswith('egg'):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   146
                self.install_dir = sys.prefix
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   147
            old_install_data.run(self)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   148
            self.install_dir = _old_install_dir
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   149
    try:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   150
        import setuptools.command.easy_install # only if easy_install available
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   151
        # monkey patch: Crack SandboxViolation verification
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   152
        from setuptools.sandbox import DirectorySandbox as DS
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   153
        old_ok = DS._ok
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   154
        def _ok(self, path):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   155
            """Return True if ``path`` can be written during installation."""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   156
            out = old_ok(self, path) # here for side effect from setuptools
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   157
            realpath = os.path.normcase(os.path.realpath(path))
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   158
            allowed_path = os.path.normcase(sys.prefix)
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   159
            if realpath.startswith(allowed_path):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   160
                out = True
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   161
            return out
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   162
        DS._ok = _ok
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   163
    except ImportError:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   164
        pass
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   165
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   166
def install(**kwargs):
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   167
    """setup entry point"""
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   168
    if USE_SETUPTOOLS:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   169
        if '--force-manifest' in sys.argv:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   170
            sys.argv.remove('--force-manifest')
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   171
    # install-layout option was introduced in 2.5.3-1~exp1
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   172
    elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   173
        sys.argv.remove('--install-layout=deb')
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   174
    cmdclass = {'install_lib': MyInstallLib}
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   175
    if USE_SETUPTOOLS:
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   176
        kwargs['install_requires'] = install_requires
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   177
        kwargs['dependency_links'] = dependency_links
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   178
        kwargs['zip_safe'] = False
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   179
        cmdclass['install_data'] = MyInstallData
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   180
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   181
    return setup(name = distname,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   182
                 version = version,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   183
                 license = license,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   184
                 description = description,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   185
                 long_description = long_description,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   186
                 author = author,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   187
                 author_email = author_email,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   188
                 url = web,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   189
                 scripts = ensure_scripts(scripts),
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   190
                 data_files = data_files,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   191
                 ext_modules = ext_modules,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   192
                 cmdclass = cmdclass,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   193
                 classifiers = classifiers,
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   194
                 **kwargs
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   195
                 )
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   196
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   197
if __name__ == '__main__' :
b05f361db666 Project structure
Christophe de Vienne <christophe@unlish.com>
parents:
diff changeset
   198
    install()