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