diff --git a/CHANGELOG b/CHANGELOG index 6be150e68..cc8275c69 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,11 @@ Changes between 1.1.2 and 1.1.1 ===================================== +- install 'py.test' and `py.which` with a ``-$VERSION`` suffix to + disambiguate between Python3, python2.X, Jython and PyPy installed versions. + - fix assert reinterpreation that sees a call containing "keyword=..." + - skip some install-tests if no execnet is available Changes between 1.1.1 and 1.1.0 diff --git a/bin-for-dist/test_install.py b/bin-for-dist/test_install.py index 62a875227..2a3d9f1e7 100644 --- a/bin-for-dist/test_install.py +++ b/bin-for-dist/test_install.py @@ -143,3 +143,29 @@ def test_plugin_setuptools_entry_point_integration(py_setup, venv, tmpdir): venv.setup_develop() out = venv.pytest_getouterr("-h") assert "testpluginopt" in out + +def test_cmdline_entrypoints(): + from setup import cmdline_entrypoints + versioned_scripts = ['py.test', 'py.which'] + unversioned_scripts = versioned_scripts + [ 'py.cleanup', + 'py.convert_unittest', 'py.countloc', 'py.lookup', 'py.svnwcrevert'] + for ver in [(2,4,0), (2,5,0), (2,6,0), (2,7,0), (3,0,1), (3,1,1)]: + for platform in ('posix', 'win32'): + points = cmdline_entrypoints(ver, "posix", 'python') + for script in versioned_scripts: + script_ver = script + "-%s.%s" % ver[:2] + assert script_ver in points + for script in unversioned_scripts: + assert script in points + points = cmdline_entrypoints((2,5,1), "java1.6.123", 'jython') + for script in versioned_scripts: + expected = "%s-jython" % script + assert expected in points + for script in unversioned_scripts: + assert script in points + points = cmdline_entrypoints((2,5,1), "xyz", 'pypy-c-XYZ') + for script in versioned_scripts: + expected = "%s-pypy-c-XYZ" % script + assert expected in points + for script in unversioned_scripts: + assert script in points diff --git a/doc/bin.txt b/doc/bin.txt index 2d12c47eb..70a156811 100644 --- a/doc/bin.txt +++ b/doc/bin.txt @@ -1,22 +1,40 @@ ====================== -``py/bin/`` scripts +pylib scripts ====================== -The py-lib contains some scripts, most of which are -small ones (apart from ``py.test``) that help during -the python development process. If working -from a svn-checkout of py lib you may add ``py/bin`` -to your shell ``PATH`` which should make the scripts -available on your command prompt. +The pylib installs several scripts to support testing and (python) +development. If working from a checkout you may also add ``bin`` to +your ``PATH`` environment variable which makes the scripts available on +your shell prompt. -``py.test`` -=========== +``py.test`` and ``py.test-$VERSION`` +============================================ -The ``py.test`` executable is the main entry point into the py-lib testing tool, -see the `py.test documentation`_. +The ``py.test`` executable is the main tool that the py lib offers; +in fact most code in the py lib is geared towards supporting the +testing process. See the `py.test documentation`_ for extensive +documentation. The ``py.test-$VERSION`` is the same script with +an interpreter specific suffix appended to make +several versions of py.test for using specific interpreters +accessible: + +* CPython2.4: py.test-2.4 +* CPython2.5: py.test-2.5 +* ... +* CPython3.1: py.test-3.1 +* Jython-2.5.1: py.test-jython +* pypy-$SUFFIX: py.test-pypy-$SUFFIX .. _`py.test documentation`: test/index.html +``py.which`` and ``py.which-$VERSION`` +========================================= + +Usage: ``py.which modulename`` + +Print the ``__file__`` of the module that is imported via ``import modulename``. +The version-suffix is the same as with ``py.test`` above. + ``py.cleanup`` ============== @@ -26,7 +44,6 @@ Delete pyc file recursively, starting from ``PATH`` (which defaults to the current working directory). Don't follow links and don't recurse into directories with a ".". - ``py.countloc`` =============== @@ -46,25 +63,3 @@ Looks recursively at Python files for a ``SEARCH_STRING``, starting from the present working directory. Prints the line, with the filename and line-number prepended. -``py.rest`` -=========== - -Usage: ``py.rest [PATHS] [options]`` - -[deprecated in 1.0, will likely be separated] -Loot recursively for .txt files starting from ``PATHS`` and convert them to -html using docutils or to pdf files, if the ``--pdf`` option is used. For -conversion to PDF you will need several command line tools, on Ubuntu Linux -this is **texlive** and **texlive-extra-utils**. - -``py.rest`` has some extra features over rst2html (which is shipped with -docutils). Most of these are still experimental, the one which is most likely -not going to change is the `graphviz`_ directive. With that you can embed .dot -files into your document and have them be converted to png (when outputting -html) and to eps (when outputting pdf). Otherwise the directive works mostly -like the image directive:: - - .. graphviz:: example.dot - :scale: 90 - -.. _`graphviz`: http://www.graphviz.org diff --git a/doc/install.txt b/doc/install.txt index c8cf5f544..9a65aafda 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -3,19 +3,30 @@ Downloading ============== -.. _`PyPI project page`: http://pypi.python.org/pypi/py/ +.. _`index page`: http://pypi.python.org/pypi/py/ -py.test/pylib compat/install info in a nutshell +py.test/pylib installation info in a nutshell =================================================== -PyPI Pyckage name: "**py**", see `PyPI project page`_ for latest version +**Pythons**: 2.4, 2.5, 2.6, 3.0, 3.1, Jython-2.5.1, PyPy-1.1 -Installers: easy_install_ and pip_, setuptools_ or Distribute_ +**Operating systems**: Linux, Windows, OSX, Unix -Pythons: 2.4, 2.5, 2.6, 3.0, 3.1, Jython-2.5.1, PyPy-1.1 +**Requirements**: setuptools_ or Distribute_ -Operating systems: Linux, Windows and OSX + probably many others +**Installers**: easy_install_ and pip_ + +**Distribution names**: + +* PyPI name: ``py`` (see `index page`_ for versions) +* redhat fedora: ``pylib`` +* debian: ``python-codespeak-lib`` +* gentoo: ``pylib`` + +**Installed scripts**: see `bin`_ for which scripts are installed. + +.. _`bin`: bin.html Best practise: install tool and dependencies virtually @@ -28,12 +39,6 @@ you need to run your tests. Local virtual Python environments (as opposed to system-wide "global" environments) make for a more reproducible and reliable test environment. -Note: as of November 2009 pytest/pylib 1.1 RPMs and DEB packages -are not available. If you want to easy_install the newest py.test -and pylib do everyone a favour and uninstall older versions -from the global system e.g. like this on Ubuntu:: - - sudo apt-get remove --purge python-codespeak-lib .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv .. _`buildout`: http://www.buildout.org/ diff --git a/py/__init__.py b/py/__init__.py index 8ab407234..7c49ef5c5 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -9,7 +9,7 @@ dictionary or an import path. (c) Holger Krekel and others, 2009 """ -version = "1.1.1" +version = "1.1.2" __version__ = version = version or "1.1.x" import py.apipkg diff --git a/setup.py b/setup.py index f3579ebb9..a756b208c 100644 --- a/setup.py +++ b/setup.py @@ -28,20 +28,13 @@ def main(): name='py', description='py.test and pylib: rapid testing and development utils.', long_description = long_description, - version= trunk or '1.1.1', + version= trunk or '1.1.2', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel, Guido Wesdorp, Carl Friedrich Bolz, Armin Rigo, Maciej Fijalkowski & others', author_email='holger at merlinux.eu', - entry_points={'console_scripts': [ - 'py.cleanup = py.cmdline:pycleanup', - 'py.convert_unittest = py.cmdline:pyconvert_unittest', - 'py.countloc = py.cmdline:pycountloc', - 'py.lookup = py.cmdline:pylookup', - 'py.svnwcrevert = py.cmdline:pysvnwcrevert', - 'py.test = py.cmdline:pytest', - 'py.which = py.cmdline:pywhich']}, + entry_points= make_entry_points(), classifiers=['Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', @@ -69,6 +62,31 @@ def main(): zip_safe=False, ) +def cmdline_entrypoints(versioninfo, platform, basename): + if basename.startswith("pypy"): + points = {'py.test-%s' % basename: 'py.cmdline:pytest', + 'py.which-%s' % basename: 'py.cmdline:pywhich',} + elif platform.startswith('java'): + points = {'py.test-jython': 'py.cmdline:pytest', + 'py.which-jython': 'py.cmdline:pywhich'} + else: # cpython + points = { + 'py.test-%s.%s' % versioninfo[:2] : 'py.cmdline:pytest', + 'py.which-%s.%s' % versioninfo[:2] : 'py.cmdline:pywhich' + } + for x in ['py.cleanup', 'py.convert_unittest', 'py.countloc', + 'py.lookup', 'py.svnwcrevert', 'py.which', 'py.test']: + points[x] = "py.cmdline:%s" % x.replace('.','') + return points + +def make_entry_points(): + basename = os.path.basename(sys.executable) + points = cmdline_entrypoints(sys.version_info, sys.platform, basename) + keys = list(points.keys()) + keys.sort() + l = ["%s = %s" % (x, points[x]) for x in keys] + return {'console_scripts': l} + if __name__ == '__main__': main()