Show More
@@ -1,87 +1,88 b'' | |||
|
1 | 1 | |
|
2 | 2 | # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py |
|
3 | 3 | OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} |
|
4 | 4 | |
|
5 | 5 | .PHONY: clean |
|
6 | 6 | ## Cleanup compiled and cache py files |
|
7 | 7 | clean: |
|
8 | 8 | make test-clean |
|
9 | 9 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | .PHONY: test |
|
13 | 13 | ## Run tests |
|
14 | 14 | test: |
|
15 | 15 | make test-clean |
|
16 | 16 | make test-only |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | .PHONY: test-only |
|
20 | 20 | ## Run tests only without cleanup |
|
21 | 21 | test-only: |
|
22 | 22 | PYTHONHASHSEED=random \ |
|
23 | 23 | py.test -x -vv -r xw -p no:sugar \ |
|
24 | 24 | --cov-report=term-missing --cov-report=html --cov=vcsserver vcsserver |
|
25 | 25 | |
|
26 | 26 | |
|
27 | 27 | .PHONY: test-clean |
|
28 | 28 | ## Cleanup test run artifacts |
|
29 | 29 | test-clean: |
|
30 | 30 | rm -rf coverage.xml htmlcov junit.xml pylint.log result |
|
31 | 31 | find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' |
|
32 | find . -type d -name ".pytest_cache" -prune -exec rm -rf '{}' ';' | |
|
32 | 33 | find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' |
|
33 | 34 | |
|
34 | 35 | .PHONY: pip-packages |
|
35 | 36 | ## Show outdated packages |
|
36 | 37 | pip-packages: |
|
37 | 38 | python ${OUTDATED_PACKAGES} |
|
38 | 39 | |
|
39 | 40 | |
|
40 | 41 | .PHONY: sdist |
|
41 | 42 | ## Build sdist |
|
42 | 43 | sdist: |
|
43 | 44 | python setup.py sdist |
|
44 | 45 | |
|
45 | 46 | |
|
46 | 47 | # Default command on calling make |
|
47 | 48 | .DEFAULT_GOAL := show-help |
|
48 | 49 | |
|
49 | 50 | .PHONY: show-help |
|
50 | 51 | show-help: |
|
51 | 52 | @echo "$$(tput bold)Available rules:$$(tput sgr0)" |
|
52 | 53 | @echo |
|
53 | 54 | @sed -n -e "/^## / { \ |
|
54 | 55 | h; \ |
|
55 | 56 | s/.*//; \ |
|
56 | 57 | :doc" \ |
|
57 | 58 | -e "H; \ |
|
58 | 59 | n; \ |
|
59 | 60 | s/^## //; \ |
|
60 | 61 | t doc" \ |
|
61 | 62 | -e "s/:.*//; \ |
|
62 | 63 | G; \ |
|
63 | 64 | s/\\n## /---/; \ |
|
64 | 65 | s/\\n/ /g; \ |
|
65 | 66 | p; \ |
|
66 | 67 | }" ${MAKEFILE_LIST} \ |
|
67 | 68 | | LC_ALL='C' sort --ignore-case \ |
|
68 | 69 | | awk -F '---' \ |
|
69 | 70 | -v ncol=$$(tput cols) \ |
|
70 | 71 | -v indent=19 \ |
|
71 | 72 | -v col_on="$$(tput setaf 6)" \ |
|
72 | 73 | -v col_off="$$(tput sgr0)" \ |
|
73 | 74 | '{ \ |
|
74 | 75 | printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ |
|
75 | 76 | n = split($$2, words, " "); \ |
|
76 | 77 | line_length = ncol - indent; \ |
|
77 | 78 | for (i = 1; i <= n; i++) { \ |
|
78 | 79 | line_length -= length(words[i]) + 1; \ |
|
79 | 80 | if (line_length <= 0) { \ |
|
80 | 81 | line_length = ncol - indent - length(words[i]) - 1; \ |
|
81 | 82 | printf "\n%*s ", -indent, " "; \ |
|
82 | 83 | } \ |
|
83 | 84 | printf "%s ", words[i]; \ |
|
84 | 85 | } \ |
|
85 | 86 | printf "\n"; \ |
|
86 | 87 | }' \ |
|
87 | 88 | | more $(shell test $(shell uname) == Darwin && echo '--no-init --raw-control-chars') |
@@ -1,163 +1,163 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # RhodeCode VCSServer provides access to different vcs backends via network. |
|
4 | 4 | # Copyright (C) 2014-2019 RodeCode GmbH |
|
5 | 5 | # |
|
6 | 6 | # This program is free software; you can redistribute it and/or modify |
|
7 | 7 | # it under the terms of the GNU General Public License as published by |
|
8 | 8 | # the Free Software Foundation; either version 3 of the License, or |
|
9 | 9 | # (at your option) any later version. |
|
10 | 10 | # |
|
11 | 11 | # This program is distributed in the hope that it will be useful, |
|
12 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | # GNU General Public License for more details. |
|
15 | 15 | # |
|
16 | 16 | # You should have received a copy of the GNU General Public License |
|
17 | 17 | # along with this program; if not, write to the Free Software Foundation, |
|
18 | 18 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 | 19 | |
|
20 | 20 | # Import early to make sure things are patched up properly |
|
21 | 21 | from setuptools import setup, find_packages |
|
22 | 22 | |
|
23 | 23 | import os |
|
24 | 24 | import re |
|
25 | 25 | import sys |
|
26 | 26 | import pkgutil |
|
27 | 27 | import platform |
|
28 | 28 | import codecs |
|
29 | 29 | |
|
30 | 30 | import pip |
|
31 | 31 | |
|
32 | 32 | pip_major_version = int(pip.__version__.split(".")[0]) |
|
33 | 33 | if pip_major_version >= 20: |
|
34 | 34 | from pip._internal.req import parse_requirements |
|
35 | 35 | from pip._internal.network.session import PipSession |
|
36 | 36 | elif pip_major_version >= 10: |
|
37 | 37 | from pip._internal.req import parse_requirements |
|
38 | 38 | from pip._internal.download import PipSession |
|
39 | 39 | else: |
|
40 | 40 | from pip.req import parse_requirements |
|
41 | 41 | from pip.download import PipSession |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | def get_package_name(req_object): |
|
45 | 45 | package_name = None |
|
46 | 46 | try: |
|
47 | 47 | from pip._internal.req.constructors import install_req_from_parsed_requirement |
|
48 | 48 | except ImportError: |
|
49 | 49 | install_req_from_parsed_requirement = None |
|
50 | 50 | |
|
51 | 51 | # In 20.1 of pip, the requirements object changed |
|
52 | 52 | if hasattr(req_object, 'req'): |
|
53 | 53 | package_name = req_object.req.name |
|
54 | 54 | |
|
55 | 55 | if package_name is None: |
|
56 | 56 | if install_req_from_parsed_requirement: |
|
57 | 57 | package = install_req_from_parsed_requirement(req_object) |
|
58 | 58 | package_name = package.req.name |
|
59 | 59 | |
|
60 | 60 | if package_name is None: |
|
61 | 61 | # fallback for older pip |
|
62 | 62 | package_name = re.split('===|<=|!=|==|>=|~=|<|>', req_object.requirement)[0] |
|
63 | 63 | |
|
64 | 64 | return package_name |
|
65 | 65 | |
|
66 | 66 | |
|
67 | 67 | if sys.version_info < (2, 7): |
|
68 | 68 | raise Exception('VCSServer requires Python 2.7 or later') |
|
69 | 69 | |
|
70 | 70 | here = os.path.abspath(os.path.dirname(__file__)) |
|
71 | 71 | |
|
72 | 72 | # defines current platform |
|
73 | 73 | __platform__ = platform.system() |
|
74 | 74 | __license__ = 'GPL V3' |
|
75 | 75 | __author__ = 'RhodeCode GmbH' |
|
76 | 76 | __url__ = 'https://code.rhodecode.com' |
|
77 | 77 | is_windows = __platform__ in ('Windows',) |
|
78 | 78 | |
|
79 | 79 | |
|
80 | 80 | def _get_requirements(req_filename, exclude=None, extras=None): |
|
81 | 81 | extras = extras or [] |
|
82 | 82 | exclude = exclude or [] |
|
83 | 83 | |
|
84 | 84 | try: |
|
85 | 85 | parsed = parse_requirements( |
|
86 | 86 | os.path.join(here, req_filename), session=PipSession()) |
|
87 | 87 | except TypeError: |
|
88 | 88 | # try pip < 6.0.0, that doesn't support session |
|
89 | 89 | parsed = parse_requirements(os.path.join(here, req_filename)) |
|
90 | 90 | |
|
91 | 91 | requirements = [] |
|
92 | 92 | for int_req in parsed: |
|
93 | 93 | req_name = get_package_name(int_req) |
|
94 | 94 | if req_name not in exclude: |
|
95 | 95 | requirements.append(req_name) |
|
96 | 96 | return requirements + extras |
|
97 | 97 | |
|
98 | 98 | |
|
99 | 99 | # requirements extract |
|
100 | 100 | setup_requirements = [] |
|
101 | 101 | install_requirements = _get_requirements( |
|
102 | 102 | 'requirements.txt', exclude=['setuptools']) |
|
103 | 103 | test_requirements = _get_requirements( |
|
104 | 104 | 'requirements_test.txt', extras=['configobj']) |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | def get_version(): |
|
108 | 108 | version = pkgutil.get_data('vcsserver', 'VERSION') |
|
109 | 109 | return version.decode().strip() |
|
110 | 110 | |
|
111 | 111 | |
|
112 | 112 | # additional files that goes into package itself |
|
113 | 113 | package_data = { |
|
114 | 114 | '': ['*.txt', '*.rst'], |
|
115 | 115 | 'configs': ['*.ini'], |
|
116 | 116 | 'vcsserver': ['VERSION'], |
|
117 | 117 | } |
|
118 | 118 | |
|
119 | 119 | description = 'Version Control System Server' |
|
120 | 120 | keywords = ' '.join(['Version Control System']) |
|
121 | 121 | |
|
122 | 122 | # README/DESCRIPTION generation |
|
123 | 123 | readme_file = 'README.rst' |
|
124 | 124 | changelog_file = 'CHANGES.rst' |
|
125 | 125 | try: |
|
126 | 126 | long_description = codecs.open(readme_file).read() + '\n\n' + \ |
|
127 | 127 | codecs.open(changelog_file).read() |
|
128 | 128 | except IOError as err: |
|
129 | 129 | sys.stderr.write( |
|
130 | 130 | "[WARNING] Cannot find file specified as long_description (%s)\n " |
|
131 | 131 | "or changelog (%s) skipping that file" % (readme_file, changelog_file)) |
|
132 | 132 | long_description = description |
|
133 | 133 | |
|
134 | 134 | |
|
135 | 135 | setup( |
|
136 | 136 | name='rhodecode-vcsserver', |
|
137 | 137 | version=get_version(), |
|
138 | 138 | description=description, |
|
139 | 139 | long_description=long_description, |
|
140 | 140 | keywords=keywords, |
|
141 | 141 | license=__license__, |
|
142 | 142 | author=__author__, |
|
143 | 143 | author_email='support@rhodecode.com', |
|
144 | 144 | url=__url__, |
|
145 | 145 | setup_requires=setup_requirements, |
|
146 | 146 | install_requires=install_requirements, |
|
147 | 147 | tests_require=test_requirements, |
|
148 | 148 | zip_safe=False, |
|
149 | 149 | packages=find_packages(exclude=["docs", "tests*"]), |
|
150 | 150 | package_data=package_data, |
|
151 | 151 | include_package_data=True, |
|
152 | 152 | classifiers=[ |
|
153 | 153 | 'Development Status :: 6 - Mature', |
|
154 | 154 | 'Intended Audience :: Developers', |
|
155 | 155 | 'Operating System :: OS Independent', |
|
156 | 156 | 'Topic :: Software Development :: Version Control', |
|
157 | 157 | 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', |
|
158 |
'Programming Language :: Python :: |
|
|
158 | 'Programming Language :: Python :: 3.10', | |
|
159 | 159 | ], |
|
160 | 160 | entry_points={ |
|
161 | 161 | 'paste.app_factory': ['main=vcsserver.http_main:main'] |
|
162 | 162 | }, |
|
163 | 163 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now