Skip to content

Commit 153b6e2

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 e538304 commit 153b6e2

File tree

5 files changed

+13
-38
lines changed

5 files changed

+13
-38
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: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,20 @@ 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

32-
#. Install LNT into the virtual environment::
19+
#. Create a new virtual environment for the LNT application and activate it::
3320

34-
~/mysandbox/bin/python ~/lnt/setup.py develop
21+
python3 -m venv .venv
22+
source .venv/bin/activate
23+
24+
#. Install LNT into the virtual environment::
3525

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.
26+
pip install -r requirements.txt
4227

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

4530

4631
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):

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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
# we didn't install package data properly).
33
#
44
# RUN: rm -rf %t.venv
5-
# RUN: virtualenv %t.venv
6-
# RUN: %t.venv/bin/python %{src_root}/setup.py install
5+
# RUN: python -m venv %t.venv
6+
# RUN: cd %{src_root}
7+
# RUN: %t.venv/bin/python -m pip install -r requirements.txt
78
# RUN: rm -rf %t.installation
89
# RUN: %t.venv/bin/lnt create %t.installation
9-
#
10-
# Disable this test by default, it is very slow because it does a full install.
11-
#
12-
# REQUIRES: long

0 commit comments

Comments
 (0)