Skip to content

Commit 92c65d6

Browse files
committed
Update installation instructions and run the installation test unconditionally
The installation instructions were based on running `setup.py` directly. However, my understanding is that Python best practices have moved away from doing that and towards using `pip` to install packages in a virtual environment, and using a file like `requirements.txt` to pin dependency versions. This patch documents that updated installation procedure and runs the installation process as a test unconditionally. Fixes #68
1 parent 4b174d5 commit 92c65d6

File tree

10 files changed

+49
-60
lines changed

10 files changed

+49
-60
lines changed

docs/developer_guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ started.
1010
Installation
1111
------------
1212

13-
See :ref:`quickstart` for setting up an installation. Use the "develop" option
14-
when running ~/lnt/setup.py.
13+
See :ref:`quickstart` for setting up an installation. Pass ``-e`` to ``pip`` when
14+
installing the package to install it in "editable" mode.
1515

1616
Running LNT's Regression Tests
1717
------------------------------

docs/quickstart.rst

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,24 @@ Installation
1212
The first thing to do is to checkout install the LNT software itself. The
1313
following steps should suffice on any modern Unix variant:
1414

15-
#. Install ``virtualenv``, if necessary::
16-
17-
sudo easy_install virtualenv
18-
19-
``virtualenv`` is a standard Python tool for allowing the installation of
20-
Python applications into their own sandboxes, or virtual environments.
21-
22-
#. Create a new virtual environment for the LNT application::
23-
24-
virtualenv ~/mysandbox
25-
26-
This will create a new virtual environment at ``~/mysandbox``.
27-
2815
#. Checkout the LNT sources::
2916

3017
git clone https://github.com/llvm/llvm-lnt.git ~/lnt
3118

19+
#. Create a new virtual environment for the LNT application and activate it::
20+
21+
python3 -m venv .venv
22+
source .venv/bin/activate
23+
3224
#. Install LNT into the virtual environment::
3325

34-
~/mysandbox/bin/python ~/lnt/setup.py develop
26+
pip install -r requirements.txt
3527

36-
We recommend using ``develop`` instead of install for local use, so that any
37-
changes to the LNT sources are immediately propagated to your
38-
installation. If you are running a production install or care a lot about
39-
stability, you can use ``install`` which will copy in the sources and you
40-
will need to explicitly re-install when you wish to update the LNT
41-
application.
28+
Note that if you only want to use the client-side features of ``lnt``, you can
29+
install the requirements specified in ``requirements.client.txt`` instead, which
30+
are a bit more lightweight.
4231

43-
That's it!
32+
That's it! ``lnt`` should now be accessible from the virtual environment.
4433

4534

4635
Running Tests

lnt/lnttool/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,7 @@ def _version_check():
475475
installed = "{} {}".format(meta['Name'], meta['Version'])
476476
current = "{} {}".format(lnt.__name__, lnt.__version__)
477477
raise SystemExit(f"""\
478-
error: installed distribution {installed} is not current ({current}), you may need to reinstall
479-
LNT or rerun 'setup.py develop' if using development mode.""")
478+
error: installed distribution {installed} is not current ({current}), you may need to reinstall LNT""")
480479

481480

482481
def show_version(ctx, param, value):

requirements.client.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
.
1+
# These requirements are what you would install to run the client.
2+
# The client has fewer requirements than the server code.
3+
.
4+
aniso8601==1.2.0
5+
click==6.7
6+
Flask-RESTful==0.3.4
7+
Flask-WTF==0.12
8+
Flask==0.12.2
9+
itsdangerous==0.24
10+
Jinja2==2.11.3
11+
MarkupSafe==1.1.1
12+
python-gnupg==0.3.7
13+
pytz==2016.10
14+
SQLAlchemy==1.3.24
15+
Werkzeug==0.15.6
16+
WTForms==2.0.2
17+
pyyaml==5.1.2

requirements.server.txt

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
# These requirements are what you would install on a production server.
2+
# The server has more requirements than the client.
23
.
3-
aniso8601==1.2.0
4-
click==6.7
5-
Flask-RESTful==0.3.4
6-
Flask-WTF==0.12
7-
Flask==0.12.2
4+
-r requirements.client.txt
85
gunicorn==19.9.0
9-
itsdangerous==0.24
10-
Jinja2==2.11.3
11-
MarkupSafe==1.1.1
12-
progressbar2
136
psycopg2==2.9.10
14-
python-gnupg==0.3.7
15-
pytz==2016.10
16-
pyyaml==5.1.2
17-
SQLAlchemy==1.3.24
18-
Werkzeug==0.15.6
19-
WTForms==2.0.2

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-r requirements.server.txt
1+
-r requirements.server.txt

setup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
os.environ["CXX"] = "xcrun --sdk macosx clang"
1515
cflags += ['-stdlib=libc++', '-mmacosx-version-min=10.7']
1616

17-
# setuptools expects to be invoked from within the directory of setup.py, but
18-
# it is nice to allow:
19-
# python path/to/setup.py install
20-
# to work (for scripts, etc.)
21-
os.chdir(os.path.dirname(os.path.abspath(__file__)))
22-
2317
cPerf = Extension('lnt.testing.profile.cPerf',
2418
sources=['lnt/testing/profile/cPerf.cpp'],
2519
extra_compile_args=['-std=c++11'] + cflags)

tests/utils/Installation.py

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Check that installation using the client requirements works properly.
2+
#
3+
# RUN: rm -rf %t.venv
4+
# RUN: python -m venv %t.venv
5+
# RUN: cd %{src_root}
6+
# RUN: %t.venv/bin/python -m pip install -r requirements.client.txt
7+
# RUN: rm -rf %t.installation
8+
# RUN: %t.venv/bin/lnt create %t.installation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Check that installation using the server requirements works properly.
2+
#
3+
# RUN: rm -rf %t.venv
4+
# RUN: python -m venv %t.venv
5+
# RUN: cd %{src_root}
6+
# RUN: %t.venv/bin/python -m pip install -r requirements.server.txt
7+
# RUN: rm -rf %t.installation
8+
# RUN: %t.venv/bin/lnt create %t.installation

0 commit comments

Comments
 (0)