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