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