From 8a5c3c0c698621ba41ce127b51d27f1fccd917c0 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 24 Dec 2009 12:27:15 +0100 Subject: [PATCH] cleanup bin-script creation, fix docs, add FAQ entry about py.test --version --HG-- branch : trunk --- CHANGELOG | 3 +++ bin-for-dist/genscripts.py | 6 ++---- bin/_findpy.py | 4 +++- doc/faq.txt | 9 +++++++++ doc/install.txt | 41 +++++++++++++++++--------------------- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cc8275c69..8fb8fb2ba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ Changes between 1.1.2 and 1.1.1 - skip some install-tests if no execnet is available +- fix docs, fix internal bin/ script generation + + Changes between 1.1.1 and 1.1.0 ===================================== diff --git a/bin-for-dist/genscripts.py b/bin-for-dist/genscripts.py index 1ffcb11e1..b86d69029 100644 --- a/bin-for-dist/genscripts.py +++ b/bin-for-dist/genscripts.py @@ -1,6 +1,6 @@ -from _findpy import py +import py -bindir = py.magic.autopath().dirpath().dirpath("py").join("bin") +bindir = py.path.local(__file__).dirpath().dirpath("bin") assert bindir.check(), bindir def getbasename(name): @@ -31,5 +31,3 @@ if __name__ == "__main__": if name[0] != "_": genscript_unix(name) genscript_windows(name) - - diff --git a/bin/_findpy.py b/bin/_findpy.py index c0c64581e..16992452a 100755 --- a/bin/_findpy.py +++ b/bin/_findpy.py @@ -1,7 +1,9 @@ #!/usr/bin/env python # -# find and import a version of 'py' +# find and import a version of 'py' that exists in a parent dir +# of the current working directory. fall back to import a +# globally available version # import sys import os diff --git a/doc/faq.txt b/doc/faq.txt index 7705cad6b..bf69c645c 100644 --- a/doc/faq.txt +++ b/doc/faq.txt @@ -63,6 +63,15 @@ issues where people have used the term "magic" in the past: .. _`py namespaces`: index.html .. _`py/__init__.py`: http://bitbucket.org/hpk42/py-trunk/src/trunk/py/__init__.py +Where does my ``py.test`` come/import from? +---------------------------------------------- + +You can issue:: + + py.test --version + +which tells you both version and import location of the tool. + function arguments, parametrized tests and setup ==================================================== diff --git a/doc/install.txt b/doc/install.txt index 9a65aafda..744f01c09 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -116,52 +116,47 @@ in order to work inline with the tools and the lib of your checkout. .. _`directly use a checkout`: -directly use a checkout or tarball +directly use a checkout or tarball / avoid setuptools ------------------------------------------------------------- -Once you got yourself a checkout_ or tarball_ it is usually a good -idea to add the parent directory of the ``py`` package directory -to your ``PYTHONPATH`` and ``py/bin`` or ``py\bin\win32`` to your -system wide ``PATH`` settings. There are helper scripts that -set ``PYTHONPATH`` and ``PATH`` on your system: +Get a checkout_ or tarball_ and add paths to your environment variables: -on windows execute:: +* ``PYTHONPATH`` needs to contain the root directory (where ``py`` resides) +* ``PATH`` needs to contain ``ROOT/bin`` or ``ROOT\bin\win32`` respectively. + +There also are helper scripts that set the variables accordingly. On windows +execute:: # inside autoexec.bat or shell startup c:\\path\to\checkout\bin\env.cmd on linux/OSX add this to your shell initialization:: - # inside .bashrc + # inside e.g. .bashrc eval `python ~/path/to/checkout/bin/env.py` -both of which which will get you good settings -for ``PYTHONPATH`` and ``PATH``. +both of which which will get you good settings. If you install +the pylib this way you can easily ``hg pull && hg up`` or download +a new tarball_ to follow the development tree. -If you install ``py.test`` this way you can easily -``hg pull && hg up`` your checkout to follow the -development tree. -note: scripts look for "nearby" py-lib ------------------------------------------------------ - -Note that all `command line scripts`_ will look -for "nearby" py libs, so if you have a layout like this:: +Note that the scripts manually added like this will look for +py libs in the chain of parent directories of the current working dir. +For example, if you have a layout like this:: mypkg/ subpkg1/ tests/ tests/ - py/ + py/ issuing ``py.test subpkg1`` will use the py lib -from that projects root directory. Giving the -state of Python packaging there can be confusion -in which case issuing:: +from that projects root directory. If in doubt over where +the pylib comes from you can always do:: py.test --version -tells you both version and import location of the tool. +to see where py.test is imported from. .. _`command line scripts`: bin.html .. _contact: contact.html