##// END OF EJS Templates
setup: use pip10 compatible setup code.
marcink -
r2912:1ef2c7f6 default
parent child Browse files
Show More
@@ -1,183 +1,189 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2010-2018 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 # Import early to make sure things are patched up properly
22 22 from setuptools import setup, find_packages
23 23
24 24 import os
25 25 import sys
26 26 import pkgutil
27 27 import platform
28 import codecs
28 29
29 from pip.download import PipSession
30 try: # for pip >= 10
31 from pip._internal.req import parse_requirements
32 except ImportError: # for pip <= 9.0.3
30 33 from pip.req import parse_requirements
31 34
32 from codecs import open
35 try: # for pip >= 10
36 from pip._internal.download import PipSession
37 except ImportError: # for pip <= 9.0.3
38 from pip.download import PipSession
33 39
34 40
35 41 if sys.version_info < (2, 7):
36 42 raise Exception('RhodeCode requires Python 2.7 or later')
37 43
38 44 here = os.path.abspath(os.path.dirname(__file__))
39 45
40 46 # defines current platform
41 47 __platform__ = platform.system()
42 48 __license__ = 'AGPLv3, and Commercial License'
43 49 __author__ = 'RhodeCode GmbH'
44 50 __url__ = 'https://code.rhodecode.com'
45 51 is_windows = __platform__ in ('Windows',)
46 52
47 53
48 54 def _get_requirements(req_filename, exclude=None, extras=None):
49 55 extras = extras or []
50 56 exclude = exclude or []
51 57
52 58 try:
53 59 parsed = parse_requirements(
54 60 os.path.join(here, req_filename), session=PipSession())
55 61 except TypeError:
56 62 # try pip < 6.0.0, that doesn't support session
57 63 parsed = parse_requirements(os.path.join(here, req_filename))
58 64
59 65 requirements = []
60 66 for ir in parsed:
61 67 if ir.req and ir.name not in exclude:
62 68 requirements.append(str(ir.req))
63 69 return requirements + extras
64 70
65 71
66 72 # requirements extract
67 73 setup_requirements = ['PasteScript', 'pytest-runner']
68 74 install_requirements = _get_requirements(
69 75 'requirements.txt', exclude=['setuptools', 'entrypoints'])
70 76 test_requirements = _get_requirements(
71 77 'requirements_test.txt', extras=['configobj'])
72 78
73 79
74 80 def get_version():
75 81 version = pkgutil.get_data('rhodecode', 'VERSION')
76 82 return version.strip()
77 83
78 84
79 85 # additional files that goes into package itself
80 86 package_data = {
81 87 '': ['*.txt', '*.rst'],
82 88 'configs': ['*.ini'],
83 89 'rhodecode': ['VERSION', 'i18n/*/LC_MESSAGES/*.mo', ],
84 90 }
85 91
86 92 description = 'Source Code Management Platform'
87 93 keywords = ' '.join([
88 94 'rhodecode', 'mercurial', 'git', 'svn',
89 95 'code review',
90 96 'repo groups', 'ldap', 'repository management', 'hgweb',
91 97 'hgwebdir', 'gitweb', 'serving hgweb',
92 98 ])
93 99
94 100
95 101 # README/DESCRIPTION generation
96 102 readme_file = 'README.rst'
97 103 changelog_file = 'CHANGES.rst'
98 104 try:
99 long_description = open(readme_file).read() + '\n\n' + \
100 open(changelog_file).read()
105 long_description = codecs.open(readme_file).read() + '\n\n' + \
106 codecs.open(changelog_file).read()
101 107 except IOError as err:
102 108 sys.stderr.write(
103 109 "[WARNING] Cannot find file specified as long_description (%s)\n "
104 110 "or changelog (%s) skipping that file" % (readme_file, changelog_file))
105 111 long_description = description
106 112
107 113
108 114 setup(
109 115 name='rhodecode-enterprise-ce',
110 116 version=get_version(),
111 117 description=description,
112 118 long_description=long_description,
113 119 keywords=keywords,
114 120 license=__license__,
115 121 author=__author__,
116 122 author_email='marcin@rhodecode.com',
117 123 url=__url__,
118 124 setup_requires=setup_requirements,
119 125 install_requires=install_requirements,
120 126 tests_require=test_requirements,
121 127 zip_safe=False,
122 128 packages=find_packages(exclude=["docs", "tests*"]),
123 129 package_data=package_data,
124 130 include_package_data=True,
125 131 classifiers=[
126 132 'Development Status :: 6 - Mature',
127 133 'Environment :: Web Environment',
128 134 'Intended Audience :: Developers',
129 135 'Operating System :: OS Independent',
130 136 'Topic :: Software Development :: Version Control',
131 137 'License :: OSI Approved :: Affero GNU General Public License v3 or later (AGPLv3+)',
132 138 'Programming Language :: Python :: 2.7',
133 139 ],
134 140 message_extractors={
135 141 'rhodecode': [
136 142 ('**.py', 'python', None),
137 143 ('**.js', 'javascript', None),
138 144 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
139 145 ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
140 146 ('public/**', 'ignore', None),
141 147 ]
142 148 },
143 149 paster_plugins=['PasteScript'],
144 150 entry_points={
145 151 'enterprise.plugins1': [
146 152 'crowd=rhodecode.authentication.plugins.auth_crowd:plugin_factory',
147 153 'headers=rhodecode.authentication.plugins.auth_headers:plugin_factory',
148 154 'jasig_cas=rhodecode.authentication.plugins.auth_jasig_cas:plugin_factory',
149 155 'ldap=rhodecode.authentication.plugins.auth_ldap:plugin_factory',
150 156 'pam=rhodecode.authentication.plugins.auth_pam:plugin_factory',
151 157 'rhodecode=rhodecode.authentication.plugins.auth_rhodecode:plugin_factory',
152 158 'token=rhodecode.authentication.plugins.auth_token:plugin_factory',
153 159 ],
154 160 'paste.app_factory': [
155 161 'main=rhodecode.config.middleware:make_pyramid_app',
156 162 ],
157 163 'paste.global_paster_command': [
158 164 'ishell=rhodecode.lib.paster_commands.ishell:Command',
159 165 'upgrade-db=rhodecode.lib.paster_commands.upgrade_db:UpgradeDb',
160 166
161 167 'setup-rhodecode=rhodecode.lib.paster_commands.deprecated.setup_rhodecode:Command',
162 168 'celeryd=rhodecode.lib.paster_commands.deprecated.celeryd:Command',
163 169 ],
164 170 'pyramid.pshell_runner': [
165 171 'ipython = rhodecode.lib.pyramid_shell:ipython_shell_runner',
166 172 ],
167 173 'pytest11': [
168 174 'pylons=rhodecode.tests.pylons_plugin',
169 175 'enterprise=rhodecode.tests.plugin',
170 176 ],
171 177 'console_scripts': [
172 178 'rc-server=rhodecode.rcserver:main',
173 179 'rc-setup-app=rhodecode.lib.rc_commands.setup_rc:main',
174 180 'rc-upgrade-db=rhodecode.lib.rc_commands.upgrade_db:main',
175 181 'rc-ishell=rhodecode.lib.rc_commands.ishell:main',
176 182 'rc-ssh-wrapper=rhodecode.apps.ssh_support.lib.ssh_wrapper:main',
177 183 ],
178 184 'beaker.backends': [
179 185 'memorylru_base=rhodecode.lib.memory_lru_debug:MemoryLRUNamespaceManagerBase',
180 186 'memorylru_debug=rhodecode.lib.memory_lru_debug:MemoryLRUNamespaceManagerDebug'
181 187 ]
182 188 },
183 189 )
General Comments 0
You need to be logged in to leave comments. Login now