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