Show More
@@ -1,208 +1,208 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2020 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 re |
|
26 | 26 | import sys |
|
27 | 27 | import pkgutil |
|
28 | 28 | import platform |
|
29 | 29 | import codecs |
|
30 | 30 | |
|
31 | 31 | import pip |
|
32 | 32 | |
|
33 | 33 | pip_major_version = int(pip.__version__.split(".")[0]) |
|
34 | 34 | if pip_major_version >= 20: |
|
35 | 35 | from pip._internal.req import parse_requirements |
|
36 | 36 | from pip._internal.network.session import PipSession |
|
37 | 37 | elif pip_major_version >= 10: |
|
38 | 38 | from pip._internal.req import parse_requirements |
|
39 | 39 | from pip._internal.download import PipSession |
|
40 | 40 | else: |
|
41 | 41 | from pip.req import parse_requirements |
|
42 | 42 | from pip.download import PipSession |
|
43 | 43 | |
|
44 | 44 | |
|
45 | 45 | def get_package_name(req_object): |
|
46 | 46 | package_name = None |
|
47 | 47 | try: |
|
48 | 48 | from pip._internal.req.constructors import install_req_from_parsed_requirement |
|
49 | 49 | except ImportError: |
|
50 | 50 | install_req_from_parsed_requirement = None |
|
51 | 51 | |
|
52 | 52 | # In 20.1 of pip, the requirements object changed |
|
53 | 53 | if hasattr(req_object, 'req'): |
|
54 | 54 | package_name = req_object.req.name |
|
55 | 55 | |
|
56 | 56 | if package_name is None: |
|
57 | 57 | if install_req_from_parsed_requirement: |
|
58 | 58 | package = install_req_from_parsed_requirement(req_object) |
|
59 | 59 | package_name = package.req.name |
|
60 | 60 | |
|
61 | 61 | if package_name is None: |
|
62 | 62 | # fallback for older pip |
|
63 | 63 | package_name = re.split('===|<=|!=|==|>=|~=|<|>', req_object.requirement)[0] |
|
64 | 64 | |
|
65 | 65 | return package_name |
|
66 | 66 | |
|
67 | 67 | |
|
68 |
if sys.version_info < ( |
|
|
69 |
raise Exception('RhodeCode requires Python |
|
|
68 | if sys.version_info < (3, 10): | |
|
69 | raise Exception('RhodeCode requires Python 3.10 or later') | |
|
70 | 70 | |
|
71 | 71 | here = os.path.abspath(os.path.dirname(__file__)) |
|
72 | 72 | |
|
73 | 73 | # defines current platform |
|
74 | 74 | __platform__ = platform.system() |
|
75 | 75 | __license__ = 'AGPLv3, and Commercial License' |
|
76 | 76 | __author__ = 'RhodeCode GmbH' |
|
77 | 77 | __url__ = 'https://code.rhodecode.com' |
|
78 | 78 | is_windows = __platform__ in ('Windows',) |
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | def _get_requirements(req_filename, exclude=None, extras=None): |
|
82 | 82 | extras = extras or [] |
|
83 | 83 | exclude = exclude or [] |
|
84 | 84 | |
|
85 | 85 | try: |
|
86 | 86 | parsed = parse_requirements( |
|
87 | 87 | os.path.join(here, req_filename), session=PipSession()) |
|
88 | 88 | except TypeError: |
|
89 | 89 | # try pip < 6.0.0, that doesn't support session |
|
90 | 90 | parsed = parse_requirements(os.path.join(here, req_filename)) |
|
91 | 91 | |
|
92 | 92 | requirements = [] |
|
93 | 93 | for int_req in parsed: |
|
94 | 94 | req_name = get_package_name(int_req) |
|
95 | 95 | if req_name not in exclude: |
|
96 | 96 | requirements.append(req_name) |
|
97 | 97 | return requirements + extras |
|
98 | 98 | |
|
99 | 99 | |
|
100 | 100 | # requirements extract |
|
101 | 101 | setup_requirements = ['PasteScript'] |
|
102 | 102 | install_requirements = _get_requirements( |
|
103 | 103 | 'requirements.txt', exclude=['setuptools', 'entrypoints']) |
|
104 | 104 | test_requirements = _get_requirements( |
|
105 | 105 | 'requirements_test.txt', extras=['configobj']) |
|
106 | 106 | |
|
107 | 107 | |
|
108 | 108 | def get_version(): |
|
109 | 109 | version = pkgutil.get_data('rhodecode', 'VERSION') |
|
110 | return version.strip() | |
|
110 | return version.decode().strip() | |
|
111 | 111 | |
|
112 | 112 | |
|
113 | 113 | # additional files that goes into package itself |
|
114 | 114 | package_data = { |
|
115 | 115 | '': ['*.txt', '*.rst'], |
|
116 | 116 | 'configs': ['*.ini'], |
|
117 | 117 | 'rhodecode': ['VERSION', 'i18n/*/LC_MESSAGES/*.mo', ], |
|
118 | 118 | } |
|
119 | 119 | |
|
120 | 120 | description = 'Source Code Management Platform' |
|
121 | 121 | keywords = ' '.join([ |
|
122 | 122 | 'rhodecode', 'mercurial', 'git', 'svn', |
|
123 | 123 | 'code review', |
|
124 | 124 | 'repo groups', 'ldap', 'repository management', 'hgweb', |
|
125 | 125 | 'hgwebdir', 'gitweb', 'serving hgweb', |
|
126 | 126 | ]) |
|
127 | 127 | |
|
128 | 128 | |
|
129 | 129 | # README/DESCRIPTION generation |
|
130 | 130 | readme_file = 'README.rst' |
|
131 | 131 | changelog_file = 'CHANGES.rst' |
|
132 | 132 | try: |
|
133 | 133 | long_description = codecs.open(readme_file).read() + '\n\n' + \ |
|
134 | 134 | codecs.open(changelog_file).read() |
|
135 | 135 | except IOError as err: |
|
136 | 136 | sys.stderr.write( |
|
137 | 137 | "[WARNING] Cannot find file specified as long_description (%s)\n " |
|
138 | 138 | "or changelog (%s) skipping that file" % (readme_file, changelog_file)) |
|
139 | 139 | long_description = description |
|
140 | 140 | |
|
141 | 141 | |
|
142 | 142 | setup( |
|
143 | 143 | name='rhodecode-enterprise-ce', |
|
144 | 144 | version=get_version(), |
|
145 | 145 | description=description, |
|
146 | 146 | long_description=long_description, |
|
147 | 147 | keywords=keywords, |
|
148 | 148 | license=__license__, |
|
149 | 149 | author=__author__, |
|
150 | 150 | author_email='support@rhodecode.com', |
|
151 | 151 | url=__url__, |
|
152 | 152 | setup_requires=setup_requirements, |
|
153 | 153 | install_requires=install_requirements, |
|
154 | 154 | tests_require=test_requirements, |
|
155 | 155 | zip_safe=False, |
|
156 | 156 | packages=find_packages(exclude=["docs", "tests*"]), |
|
157 | 157 | package_data=package_data, |
|
158 | 158 | include_package_data=True, |
|
159 | 159 | classifiers=[ |
|
160 | 160 | 'Development Status :: 6 - Mature', |
|
161 | 161 | 'Environment :: Web Environment', |
|
162 | 162 | 'Intended Audience :: Developers', |
|
163 | 163 | 'Operating System :: OS Independent', |
|
164 | 164 | 'Topic :: Software Development :: Version Control', |
|
165 | 165 | 'License :: OSI Approved :: Affero GNU General Public License v3 or later (AGPLv3+)', |
|
166 |
'Programming Language :: Python :: |
|
|
166 | 'Programming Language :: Python :: 3.10', | |
|
167 | 167 | ], |
|
168 | 168 | message_extractors={ |
|
169 | 169 | 'rhodecode': [ |
|
170 | 170 | ('**.py', 'python', None), |
|
171 | 171 | ('**.js', 'javascript', None), |
|
172 | 172 | ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), |
|
173 | 173 | ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}), |
|
174 | 174 | ('public/**', 'ignore', None), |
|
175 | 175 | ] |
|
176 | 176 | }, |
|
177 | 177 | paster_plugins=['PasteScript'], |
|
178 | 178 | entry_points={ |
|
179 | 179 | 'paste.app_factory': [ |
|
180 | 180 | 'main=rhodecode.config.middleware:make_pyramid_app', |
|
181 | 181 | ], |
|
182 | 182 | 'paste.global_paster_command': [ |
|
183 | 183 | 'ishell=rhodecode.lib.paster_commands.ishell:Command', |
|
184 | 184 | 'upgrade-db=rhodecode.lib.paster_commands.upgrade_db:UpgradeDb', |
|
185 | 185 | |
|
186 | 186 | 'setup-rhodecode=rhodecode.lib.paster_commands.deprecated.setup_rhodecode:Command', |
|
187 | 187 | 'celeryd=rhodecode.lib.paster_commands.deprecated.celeryd:Command', |
|
188 | 188 | ], |
|
189 | 189 | 'pyramid.pshell_runner': [ |
|
190 | 190 | 'ipython = rhodecode.lib.pyramid_shell:ipython_shell_runner', |
|
191 | 191 | ], |
|
192 | 192 | 'pytest11': [ |
|
193 | 193 | 'pylons=rhodecode.tests.pylons_plugin', |
|
194 | 194 | 'enterprise=rhodecode.tests.plugin', |
|
195 | 195 | ], |
|
196 | 196 | 'console_scripts': [ |
|
197 | 197 | 'rc-setup-app=rhodecode.lib.rc_commands.setup_rc:main', |
|
198 | 198 | 'rc-upgrade-db=rhodecode.lib.rc_commands.upgrade_db:main', |
|
199 | 199 | 'rc-ishell=rhodecode.lib.rc_commands.ishell:main', |
|
200 | 200 | 'rc-add-artifact=rhodecode.lib.rc_commands.add_artifact:main', |
|
201 | 201 | 'rc-ssh-wrapper=rhodecode.apps.ssh_support.lib.ssh_wrapper:main', |
|
202 | 202 | ], |
|
203 | 203 | 'beaker.backends': [ |
|
204 | 204 | 'memorylru_base=rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerBase', |
|
205 | 205 | 'memorylru_debug=rhodecode.lib.memory_lru_dict:MemoryLRUNamespaceManagerDebug' |
|
206 | 206 | ] |
|
207 | 207 | }, |
|
208 | 208 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now