1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 # pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611 |
2 # pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611 |
3 # |
3 # |
4 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
4 # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 # |
6 # |
7 # This file is part of CubicWeb. |
7 # This file is part of a CubicWeb cube. |
8 # |
8 # |
9 # CubicWeb is free software: you can redistribute it and/or modify it under the |
9 # CubicWeb is free software: you can redistribute it and/or modify it under the |
10 # terms of the GNU Lesser General Public License as published by the Free |
10 # terms of the GNU Lesser General Public License as published by the Free |
11 # Software Foundation, either version 2.1 of the License, or (at your option) |
11 # Software Foundation, either version 2.1 of the License, or (at your option) |
12 # any later version. |
12 # any later version. |
37 from distutils.core import setup |
37 from distutils.core import setup |
38 from distutils.command import install_lib |
38 from distutils.command import install_lib |
39 USE_SETUPTOOLS = False |
39 USE_SETUPTOOLS = False |
40 from distutils.command import install_data |
40 from distutils.command import install_data |
41 |
41 |
42 # import required features |
42 |
43 from __pkginfo__ import modname, version, license, description, web, \ |
43 # load metadata from the __pkginfo__.py file so there is no risk of conflict |
44 author, author_email, classifiers |
44 # see https://packaging.python.org/en/latest/single_source_version.html |
45 |
45 base_dir = dirname(__file__) |
46 if exists('README'): |
46 pkginfo = {} |
47 long_description = open('README').read() |
47 with open(join(base_dir, "__pkginfo__.py")) as f: |
48 else: |
48 exec(f.read(), pkginfo) |
49 long_description = '' |
49 |
50 |
50 # get required metadatas |
51 # import optional features |
51 modname = pkginfo['modname'] |
52 import __pkginfo__ |
52 version = pkginfo['version'] |
|
53 license = pkginfo['license'] |
|
54 description = pkginfo['description'] |
|
55 web = pkginfo['web'] |
|
56 author = pkginfo['author'] |
|
57 author_email = pkginfo['author_email'] |
|
58 classifiers = pkginfo['classifiers'] |
|
59 |
|
60 with open(join(base_dir, 'README')) as f: |
|
61 long_description = f.read() |
|
62 |
|
63 # get optional metadatas |
|
64 distname = pkginfo.get('distname', modname) |
|
65 scripts = pkginfo.get('scripts', ()) |
|
66 include_dirs = pkginfo.get('include_dirs', ()) |
|
67 data_files = pkginfo.get('data_files', None) |
|
68 ext_modules = pkginfo.get('ext_modules', None) |
|
69 dependency_links = pkginfo.get('dependency_links', ()) |
|
70 |
53 if USE_SETUPTOOLS: |
71 if USE_SETUPTOOLS: |
54 requires = {} |
72 requires = {} |
55 for entry in ("__depends__",): # "__recommends__"): |
73 for entry in ("__depends__",): # "__recommends__"): |
56 requires.update(getattr(__pkginfo__, entry, {})) |
74 requires.update(pkginfo.get(entry, {})) |
57 install_requires = [("%s %s" % (d, v and v or "")).strip() |
75 install_requires = [("%s %s" % (d, v and v or "")).strip() |
58 for d, v in requires.items()] |
76 for d, v in requires.items()] |
59 else: |
77 else: |
60 install_requires = [] |
78 install_requires = [] |
61 |
79 |
62 distname = getattr(__pkginfo__, 'distname', modname) |
80 BASE_BLACKLIST = ('CVS', '.svn', '.hg', '.git', 'debian', 'dist', 'build') |
63 scripts = getattr(__pkginfo__, 'scripts', ()) |
|
64 include_dirs = getattr(__pkginfo__, 'include_dirs', ()) |
|
65 data_files = getattr(__pkginfo__, 'data_files', None) |
|
66 ext_modules = getattr(__pkginfo__, 'ext_modules', None) |
|
67 dependency_links = getattr(__pkginfo__, 'dependency_links', ()) |
|
68 |
|
69 BASE_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build') |
|
70 IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') |
81 IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~') |
71 |
82 |
72 |
83 |
73 def ensure_scripts(linux_scripts): |
84 def ensure_scripts(linux_scripts): |
74 """ |
85 """ |