Skip to content

Commit 9ecf582

Browse files
committed
Remove all past crazyness with pip in setup.py
In an attempt to be DRY, we were using the requirements files to get the dependent packages. Pip has not provided a good interface to do that, and so we have been broken a number of times. As pip has evolved, those files can now define dependencies better, so they are not needed anymore. In a standard client install (flask webserver and sqlite) we will install the packages using standard setup.py install_requires. For server installs pip can be used directly, and will use the local setup.py to get the non-server requirements. This is much more standard. Docs updated, but Docker change not tests, as I don't have a test environment.
1 parent 5acafc5 commit 9ecf582

File tree

6 files changed

+30
-52
lines changed

6 files changed

+30
-52
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RUN apk update \
44
&& apk add --no-cache --virtual .build-deps git g++ postgresql-dev yaml-dev \
55
&& apk add --no-cache libpq \
66
&& git clone https://github.com/llvm/llvm-lnt /var/src/lnt \
7-
&& python3 /var/src/lnt/setup.py install --server \
7+
&& python3 -m pip install /var/src/lnt/requirements.server.txt \
88
&& rm -rf /var/src \
99
&& apk --purge del .build-deps \
1010
&& mkdir /var/log/lnt

docs/intro.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ To install the extra packages for the server config::
104104
virtualenv venv
105105
. ./venv/bin/activate
106106
pip install -r requirements.server.txt
107-
python setup.py install --server
108107
lnt create path/to/data_dir --db-dir postgresql://user@host # data_dir path will be where lnt data will go.
109108
cd deployment
110109
# Now edit app_wrapper.py to have your path/to/data_dir path and the log-file below.

requirements.client.txt

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1 @@
1-
# Flask 0.11 does not work yet.
2-
six
3-
aniso8601==1.2.0
4-
Flask==0.12.2
5-
Flask-RESTful==0.3.4
6-
Jinja2==2.7.2
7-
MarkupSafe==0.23
8-
SQLAlchemy==1.1.11
9-
Werkzeug==0.12.2
10-
itsdangerous==0.24
11-
python-dateutil==2.6.0
12-
python-gnupg==0.3.7
13-
pytz==2016.10
14-
WTForms==2.0.2
15-
Flask-WTF==0.12
16-
typing
17-
click==6.7
18-
pyyaml==3.13
19-
requests
20-
future
21-
# Use Monorepo for LIT
22-
-e git+https://github.com/llvm/llvm-project.git#egg=lit&subdirectory=llvm/utils/lit
1+
.

requirements.server.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# These requirements are what you would install on a production server.
2-
-r requirements.client.txt
2+
.
33
psycopg2==2.8
4-
# Flask 0.11 does not work yet.
54
gunicorn==18.0
65
progressbar2

setup.py

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
try:
2-
from pip.req import parse_requirements
3-
except ImportError:
4-
# The req module has been moved to pip._internal in the 10 release.
5-
from pip._internal.req import parse_requirements
1+
from __future__ import print_function
62
import lnt
73
import os
84
from sys import platform as _platform
@@ -31,24 +27,10 @@
3127

3228
if "--server" in sys.argv:
3329
sys.argv.remove("--server")
34-
req_file = "requirements.server.txt"
35-
else:
36-
req_file = "requirements.client.txt"
37-
try:
38-
install_reqs = parse_requirements(req_file, session=False)
39-
except TypeError:
40-
# In old PIP the session flag cannot be passed.
41-
install_reqs = parse_requirements(req_file)
42-
43-
try:
44-
# Filter out git dependencies, which can't be handled by setuptools.
45-
reqs = [ir.requirement for ir in install_reqs
46-
if not ir.requirement.startswith("git+")]
47-
except AttributeError:
48-
# Old versions of pip (<20.1) returned a List[InstallRequirement] instead
49-
# of a List[ParsedRequirement], which has different member names, and does
50-
# not include git dependencies.
51-
reqs = [str(ir.req) for ir in install_reqs]
30+
print("Use pip to install requirements.server.txt for a full server install:")
31+
print("pip install -r ./requirements.server.txt")
32+
sys.exit(1)
33+
5234

5335
setup(
5436
name="LNT",
@@ -132,7 +114,28 @@
132114
'lnt = lnt.lnttool:main',
133115
],
134116
},
135-
install_requires=reqs,
117+
install_requires=[
118+
"six",
119+
"aniso8601==1.2.0",
120+
"Flask==0.12.2",
121+
"Flask-RESTful==0.3.4",
122+
"Jinja2==2.7.2",
123+
"MarkupSafe==0.23",
124+
"SQLAlchemy==1.1.11",
125+
"Werkzeug==0.12.2",
126+
"itsdangerous==0.24",
127+
"python-dateutil==2.6.0",
128+
"python-gnupg==0.3.7",
129+
"pytz==2016.10",
130+
"WTForms==2.0.2",
131+
"Flask-WTF==0.12",
132+
"typing",
133+
"click==6.7",
134+
"pyyaml==3.13",
135+
"requests",
136+
"future",
137+
"lit",
138+
],
136139

137140
ext_modules=[cPerf],
138141

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ envlist = py27
1818
[testenv]
1919
whitelist_externals = rm
2020

21-
deps = -rrequirements.txt
22-
2321
commands =
2422
rm -rf ./test_run_tmp
2523
lit -sv ./tests/

0 commit comments

Comments
 (0)