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