author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Wed, 28 Apr 2010 12:14:22 +0200 | |
changeset 5423 | e15abfdcce38 |
parent 5382 | cb5dfea92285 |
parent 5421 | 8167de96c523 |
child 5426 | 0d4853a6e5ee |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env python |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
2 |
# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152 |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
3 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
4 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
|
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
6 |
__docformat__ = "restructuredtext en" |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
7 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
8 |
import os |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
9 |
import sys |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
10 |
import shutil |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
11 |
from os.path import isdir, exists, join, walk |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
12 |
|
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
13 |
try: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
14 |
if os.environ.get('NO_SETUPTOOLS'): |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
15 |
raise ImportError() |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
16 |
from setuptools import setup |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
17 |
from setuptools.command import install_lib |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
18 |
USE_SETUPTOOLS = 1 |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
19 |
except ImportError: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
20 |
from distutils.core import setup |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
21 |
from distutils.command import install_lib |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
22 |
USE_SETUPTOOLS = 0 |
0 | 23 |
|
24 |
||
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
25 |
sys.modules.pop('__pkginfo__', None) |
0 | 26 |
# import required features |
5382
cb5dfea92285
[skeleton] short_desc is now description in pkginfo
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5360
diff
changeset
|
27 |
from __pkginfo__ import modname, version, license, description, \ |
0 | 28 |
web, author, author_email |
232
f1f26070117d
cleanup skel packaging
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
139
diff
changeset
|
29 |
# import optional features |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
30 |
import __pkginfo__ |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
31 |
distname = getattr(__pkginfo__, 'distname', modname) |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
32 |
scripts = getattr(__pkginfo__, 'scripts', []) |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
33 |
data_files = getattr(__pkginfo__, 'data_files', None) |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
34 |
include_dirs = getattr(__pkginfo__, 'include_dirs', []) |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
35 |
ext_modules = getattr(__pkginfo__, 'ext_modules', None) |
5334
7da1a6ca8f65
[skel] packaging fix: should build package without setuptools, and fix default for dependency_links
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5331
diff
changeset
|
36 |
dependency_links = getattr(__pkginfo__, 'dependency_links', []) |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
37 |
|
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
38 |
STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build') |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
39 |
|
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
40 |
IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
41 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
42 |
if exists('README'): |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
43 |
long_description = file('README').read() |
5184
955ee1b24756
[c-c newcube] #1192: simpler cubicweb-ctl newcube, and more
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5024
diff
changeset
|
44 |
else: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
45 |
long_description = '' |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
46 |
if USE_SETUPTOOLS: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
47 |
requires = {} |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
48 |
for entry in ("__depends__", "__recommends__"): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
49 |
requires.update(getattr(__pkginfo__, entry, {})) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
50 |
install_requires = [("%s %s" % (d, v and v or "")).strip() |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
51 |
for d, v in requires.iteritems()] |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
52 |
else: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
53 |
install_requires = [] |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
54 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
55 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
56 |
def ensure_scripts(linux_scripts): |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
57 |
"""Creates the proper script names required for each platform |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
58 |
(taken from 4Suite) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
59 |
""" |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
60 |
from distutils import util |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
61 |
if util.get_platform()[:3] == 'win': |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
62 |
scripts_ = [script + '.bat' for script in linux_scripts] |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
63 |
else: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
64 |
scripts_ = linux_scripts |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
65 |
return scripts_ |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
66 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
67 |
def get_packages(directory, prefix): |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
68 |
"""return a list of subpackages for the given directory""" |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
69 |
result = [] |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
70 |
for package in os.listdir(directory): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
71 |
absfile = join(directory, package) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
72 |
if isdir(absfile): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
73 |
if exists(join(absfile, '__init__.py')) or \ |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
74 |
package in ('test', 'tests'): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
75 |
if prefix: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
76 |
result.append('%s.%s' % (prefix, package)) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
77 |
else: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
78 |
result.append(package) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
79 |
result += get_packages(absfile, result[-1]) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
80 |
return result |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
81 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
82 |
def export(from_dir, to_dir, |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
83 |
blacklist=STD_BLACKLIST, |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
84 |
ignore_ext=IGNORED_EXTENSIONS, |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
85 |
verbose=True): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
86 |
"""make a mirror of from_dir in to_dir, omitting directories and files |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
87 |
listed in the black list |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
88 |
""" |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
89 |
def make_mirror(arg, directory, fnames): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
90 |
"""walk handler""" |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
91 |
for norecurs in blacklist: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
92 |
try: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
93 |
fnames.remove(norecurs) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
94 |
except ValueError: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
95 |
pass |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
96 |
for filename in fnames: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
97 |
# don't include binary files |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
98 |
if filename[-4:] in ignore_ext: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
99 |
continue |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
100 |
if filename[-1] == '~': |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
101 |
continue |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
102 |
src = join(directory, filename) |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
103 |
dest = to_dir + src[len(from_dir):] |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
104 |
if verbose: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
105 |
print >> sys.stderr, src, '->', dest |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
106 |
if os.path.isdir(src): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
107 |
if not exists(dest): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
108 |
os.mkdir(dest) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
109 |
else: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
110 |
if exists(dest): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
111 |
os.remove(dest) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
112 |
shutil.copy2(src, dest) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
113 |
try: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
114 |
os.mkdir(to_dir) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
115 |
except OSError, ex: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
116 |
# file exists ? |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
117 |
import errno |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
118 |
if ex.errno != errno.EEXIST: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
119 |
raise |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
120 |
walk(from_dir, make_mirror, None) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
121 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
122 |
|
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
123 |
class MyInstallLib(install_lib.install_lib): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
124 |
"""extend install_lib command to handle package __init__.py and |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
125 |
include_dirs variable if necessary |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
126 |
""" |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
127 |
def run(self): |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
128 |
"""overridden from install_lib class""" |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
129 |
install_lib.install_lib.run(self) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
130 |
# manually install included directories if any |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
131 |
if include_dirs: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
132 |
base = modname |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
133 |
for directory in include_dirs: |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
134 |
dest = join(self.install_dir, base, directory) |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
135 |
export(directory, dest, verbose=False) |
0 | 136 |
|
137 |
def install(**kwargs): |
|
138 |
"""setup entry point""" |
|
5360
96893296772f
[skel] fix setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5334
diff
changeset
|
139 |
if USE_SETUPTOOLS: |
96893296772f
[skel] fix setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5334
diff
changeset
|
140 |
if '--force-manifest' in sys.argv: |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
141 |
sys.argv.remove('--force-manifest') |
5360
96893296772f
[skel] fix setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5334
diff
changeset
|
142 |
# install-layout option was introduced in 2.5.3-1~exp1 |
96893296772f
[skel] fix setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5334
diff
changeset
|
143 |
elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv: |
96893296772f
[skel] fix setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5334
diff
changeset
|
144 |
sys.argv.remove('--install-layout=deb') |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
145 |
kwargs['package_dir'] = {modname : '.'} |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
146 |
packages = [modname] + get_packages(os.getcwd(), modname) |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
147 |
if USE_SETUPTOOLS and install_requires: |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
148 |
kwargs['install_requires'] = install_requires |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
149 |
kwargs['dependency_links'] = dependency_links |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
150 |
kwargs['packages'] = packages |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
151 |
return setup(name = distname, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
152 |
version = version, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
153 |
license = license, |
5382
cb5dfea92285
[skeleton] short_desc is now description in pkginfo
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5360
diff
changeset
|
154 |
description = description, |
5331
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
155 |
long_description = long_description, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
156 |
author = author, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
157 |
author_email = author_email, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
158 |
url = web, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
159 |
scripts = ensure_scripts(scripts), |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
160 |
data_files = data_files, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
161 |
ext_modules = ext_modules, |
f7ee75da6102
[skel] cleanup default cube setup.py
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5184
diff
changeset
|
162 |
cmdclass = {'install_lib': MyInstallLib}, |
5024
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
163 |
**kwargs |
9e718abe3fde
add egg support with dependencies auto-installation
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
4212
diff
changeset
|
164 |
) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
232
diff
changeset
|
165 |
|
0 | 166 |
if __name__ == '__main__' : |
167 |
install() |