[svn r57429] merging/porting the release branch changes and

cleanups to trunk.

svn merge -r 56716:HEAD ../release/0.9.x/ to trunk

--HG--
branch : trunk
This commit is contained in:
hpk 2008-08-18 17:08:39 +02:00
parent 013cbb52a1
commit 4115e975d1
23 changed files with 1086 additions and 146 deletions

79
CHANGELOG Normal file
View File

@ -0,0 +1,79 @@
$Id: CHANGELOG 57429 2008-08-18 15:08:39Z hpk $
Changes between 0.9.1 and 0.9.2
===============================
* refined installation and metadata, created new setup.py,
now based on setuptools/ez_setup (by flipping a bit you
can use distutils).
* improved the way of making py.* scripts available in
windows environments, they are now added to the
Scripts directory as ".cmd" files.
* improved py.execnet bootstrapping on windows
* py.test's traceback is better parseable from editors
(follows the filenames:LINENO: MSG convention)
* fix to javascript-generation, "py.test --runbrowser"
should work more reliably now
* removed previously accidentally added
py.test.broken and py.test.notimplemented helpers.
* there now is a py.__version__ attribute
Changes between 0.9.0 and 0.9.1
===============================
This is a fairly complete list of changes between 0.9 and 0.9.1, which can
serve as a reference for developers.
* allowing + signs in py.path.svn urls [39106]
* fixed support for Failed exceptions without excinfo in py.test [39340]
* added support for killing processes for Windows (as well as platforms that
support os.kill) in py.misc.killproc [39655]
* added setup/teardown for generative tests to py.test [40702]
* added detection of FAILED TO LOAD MODULE to py.test [40703, 40738, 40739]
* fixed problem with calling .remove() on wcpaths of non-versioned files in
py.path [44248]
* fixed some import and inheritance issues in py.test [41480, 44648, 44655]
* fail to run greenlet tests when pypy is available, but without stackless
[45294]
* small fixes in rsession tests [45295]
* fixed issue with 2.5 type representations in py.test [45483, 45484]
* made that internal reporting issues displaying is done atomically in py.test
[45518]
* made that non-existing files are igored by the py.lookup script [45519]
* improved exception name creation in py.test [45535]
* made that less threads are used in execnet [merge in 45539]
* removed lock required for atomical reporting issue displaying in py.test
[45545]
* removed globals from execnet [45541, 45547]
* refactored cleanup mechanics, made that setDaemon is set to 1 to make atexit
get called in 2.5 (py.execnet) [45548]
* fixed bug in joining threads in py.execnet's servemain [45549]
* refactored py.test.rsession tests to not rely on exact output format anymore
[45646]
* using repr() on test outcome [45647]
* added 'Reason' classes for py.test.skip() [45648, 45649]
* killed some unnecessary sanity check in py.test.collect [45655]
* avoid using os.tmpfile() in py.io.fdcapture because on Windows it's only
usable by Administrators [45901]
* added support for locking and non-recursive commits to py.path.svnwc [45994]
* locking files in py.execnet to prevent CPython from segfaulting [46010]
* added export() method to py.path.svnurl
* fixed -d -x in py.test [47277]
* fixed argument concatenation problem in py.path.svnwc [49423]
* restore py.test behaviour that it exits with code 1 when there are failures
[49974]
* don't fail on html files that don't have an accompanying .txt file [50606]
* fixed 'utestconvert.py < input' [50645]
* small fix for code indentation in py.code.source [50755]
* fix _docgen.py documentation building [51285]
* improved checks for source representation of code blocks in py.test [51292]
* added support for passing authentication to py.path.svn* objects [52000,
52001]
* removed sorted() call for py.apigen tests in favour of [].sort() to support
Python 2.3 [52481]

1
LICENSE Symbolic link
View File

@ -0,0 +1 @@
py/LICENSE

398
MANIFEST Normal file
View File

@ -0,0 +1,398 @@
CHANGELOG
LICENSE
MANIFEST
README.txt
_findpy.py
ez_setup.py
py/LICENSE
py/__init__.py
py/apigen/__init__.py
py/apigen/api.js
py/apigen/apigen.js
py/apigen/apigen.py
py/apigen/conftest.py
py/apigen/html.py
py/apigen/htmlgen.py
py/apigen/layout.py
py/apigen/linker.py
py/apigen/project.py
py/apigen/rest/__init__.py
py/apigen/rest/genrest.py
py/apigen/rest/htmlhandlers.py
py/apigen/rest/testing/__init__.py
py/apigen/rest/testing/somemodule.py
py/apigen/rest/testing/someothermodule.py
py/apigen/rest/testing/test_htmlhandlers.py
py/apigen/rest/testing/test_rest.py
py/apigen/source/__init__.py
py/apigen/source/browser.py
py/apigen/source/color.py
py/apigen/source/html.py
py/apigen/source/index.cgi
py/apigen/source/path.py
py/apigen/source/server.py
py/apigen/source/testing/__init__.py
py/apigen/source/testing/test_browser.py
py/apigen/source/testing/test_color.py
py/apigen/source/testing/test_html.py
py/apigen/style.css
py/apigen/testing/__init__.py
py/apigen/testing/test_apigen_example.py
py/apigen/testing/test_apigen_functional.py
py/apigen/testing/test_htmlgen.py
py/apigen/testing/test_linker.py
py/apigen/todo-apigen.txt
py/apigen/todo.txt
py/apigen/tracer/__init__.py
py/apigen/tracer/description.py
py/apigen/tracer/docstorage.py
py/apigen/tracer/magic.py
py/apigen/tracer/model.py
py/apigen/tracer/permastore.py
py/apigen/tracer/testing/__init__.py
py/apigen/tracer/testing/package/__init__.py
py/apigen/tracer/testing/package/submodule/__init__.py
py/apigen/tracer/testing/package/submodule/pak/__init__.py
py/apigen/tracer/testing/package/submodule/pak/mod.py
py/apigen/tracer/testing/package/submodule/pak/somenamespace.py
py/apigen/tracer/testing/runtest.py
py/apigen/tracer/testing/test_desc.py
py/apigen/tracer/testing/test_docgen.py
py/apigen/tracer/testing/test_model.py
py/apigen/tracer/testing/test_package.py
py/apigen/tracer/tracer.py
py/bin/_findpy.py
py/bin/py.cleanup
py/bin/py.countloc
py/bin/py.lookup
py/bin/py.rest
py/bin/py.test
py/builtin/__init__.py
py/builtin/enumerate.py
py/builtin/exception.py
py/builtin/reversed.py
py/builtin/set.py
py/builtin/sorted.py
py/builtin/testing/__init__.py
py/builtin/testing/test_enumerate.py
py/builtin/testing/test_exception.py
py/builtin/testing/test_reversed.py
py/builtin/testing/test_set.py
py/builtin/testing/test_sorted.py
py/c-extension/greenlet/README.txt
py/c-extension/greenlet/dummy_greenlet.py
py/c-extension/greenlet/greenlet.c
py/c-extension/greenlet/greenlet.h
py/c-extension/greenlet/setup.py
py/c-extension/greenlet/slp_platformselect.h
py/c-extension/greenlet/switch_amd64_unix.h
py/c-extension/greenlet/switch_ppc_macosx.h
py/c-extension/greenlet/switch_ppc_unix.h
py/c-extension/greenlet/switch_s390_unix.h
py/c-extension/greenlet/switch_sparc_sun_gcc.h
py/c-extension/greenlet/switch_x86_msvc.h
py/c-extension/greenlet/switch_x86_unix.h
py/c-extension/greenlet/test_generator.py
py/c-extension/greenlet/test_generator_nested.py
py/c-extension/greenlet/test_greenlet.py
py/c-extension/greenlet/test_remote.py
py/c-extension/greenlet/test_throw.py
py/code/__init__.py
py/code/code.py
py/code/excinfo.py
py/code/frame.py
py/code/safe_repr.py
py/code/source.py
py/code/testing/__init__.py
py/code/testing/test_code.py
py/code/testing/test_cpython_features.py
py/code/testing/test_excinfo.py
py/code/testing/test_frame.py
py/code/testing/test_safe_repr.py
py/code/testing/test_source.py
py/code/traceback2.py
py/compat/LICENSE
py/compat/__init__.py
py/compat/conftest.py
py/compat/doctest.py
py/compat/optparse.py
py/compat/subprocess.py
py/compat/testing/__init__.py
py/compat/testing/test_doctest.py
py/compat/testing/test_doctest.txt
py/compat/testing/test_doctest2.py
py/compat/testing/test_doctest2.txt
py/compat/testing/test_optparse.py
py/compat/testing/test_subprocess.py
py/compat/testing/test_textwrap.py
py/compat/textwrap.py
py/conftest.py
py/doc/TODO.txt
py/doc/__init__.py
py/doc/apigen.txt
py/doc/bin.txt
py/doc/code.txt
py/doc/coding-style.txt
py/doc/confrest.py
py/doc/conftest.py
py/doc/contact.txt
py/doc/download.txt
py/doc/example/genhtml.py
py/doc/example/genhtmlcss.py
py/doc/example/genxml.py
py/doc/example/pytest/failure_demo.py
py/doc/example/pytest/test_failures.py
py/doc/example/pytest/test_setup_flow_example.py
py/doc/execnet.txt
py/doc/future.txt
py/doc/future/code_template.txt
py/doc/future/planning.txt
py/doc/future/pylib_pypy.txt
py/doc/future/rsession_todo.txt
py/doc/greenlet.txt
py/doc/impl-test.txt
py/doc/index.txt
py/doc/io.txt
py/doc/links.txt
py/doc/log.txt
py/doc/misc.txt
py/doc/path.txt
py/doc/release-0.9.0.txt
py/doc/release-0.9.1.txt
py/doc/release-0.9.2.txt
py/doc/style.css
py/doc/test.txt
py/doc/test_conftest.py
py/doc/why_py.txt
py/doc/xml.txt
py/env.cmd
py/env.py
py/execnet/NOTES
py/execnet/__init__.py
py/execnet/channel.py
py/execnet/gateway.py
py/execnet/inputoutput.py
py/execnet/message.py
py/execnet/register.py
py/execnet/rsync.py
py/execnet/rsync_remote.py
py/execnet/script/__init__.py
py/execnet/script/loop_socketserver.py
py/execnet/script/quitserver.py
py/execnet/script/shell.py
py/execnet/script/socketserver.py
py/execnet/script/socketserverservice.py
py/execnet/script/xx.py
py/execnet/testing/__init__.py
py/execnet/testing/test_gateway.py
py/execnet/testing/test_pickle.py
py/execnet/testing/test_rsync.py
py/initpkg.py
py/io/__init__.py
py/io/dupfile.py
py/io/fdcapture.py
py/io/stdcapture.py
py/io/test/__init__.py
py/io/test/test_dupfile.py
py/io/test/test_fdcapture.py
py/io/test/test_stdcapture.py
py/log/__init__.py
py/log/consumer.py
py/log/logger.py
py/log/producer.py
py/log/testing/__init__.py
py/log/testing/test_log.py
py/log/testing/test_logger.py
py/magic/__init__.py
py/magic/assertion.py
py/magic/autopath.py
py/magic/exprinfo.py
py/magic/greenlet.py
py/magic/invoke.py
py/magic/patch.py
py/magic/testing/__init__.py
py/magic/testing/test_assertion.py
py/magic/testing/test_autopath.py
py/magic/testing/test_exprinfo.py
py/magic/testing/test_invoke.py
py/magic/testing/test_patch.py
py/magic/testing/test_viewtype.py
py/magic/viewtype.py
py/misc/__init__.py
py/misc/_dist.py
py/misc/buildcmodule.py
py/misc/cache.py
py/misc/cmdline/__init__.py
py/misc/cmdline/countloc.py
py/misc/conftest-socketgatewayrun.py
py/misc/difftime.py
py/misc/dynpkg.py
py/misc/error.py
py/misc/findmissingdocstrings.py
py/misc/killproc.py
py/misc/rest.py
py/misc/std.py
py/misc/svnlook.py
py/misc/terminal_helper.py
py/misc/testing/__init__.py
py/misc/testing/data/svnlookrepo.dump
py/misc/testing/test_api.py
py/misc/testing/test_cache.py
py/misc/testing/test_error.py
py/misc/testing/test_initpkg.py
py/misc/testing/test_oskill.py
py/misc/testing/test_std.py
py/misc/testing/test_svnlook.py
py/misc/testing/test_terminal.py
py/path/__init__.py
py/path/common.py
py/path/gateway/TODO.txt
py/path/gateway/__init__.py
py/path/gateway/channeltest.py
py/path/gateway/channeltest2.py
py/path/gateway/remotepath.py
py/path/local/__init__.py
py/path/local/common.py
py/path/local/local.py
py/path/local/posix.py
py/path/local/testing/__init__.py
py/path/local/testing/test_local.py
py/path/local/testing/test_posix.py
py/path/local/testing/test_win.py
py/path/local/win.py
py/path/svn/__init__.py
py/path/svn/cache.py
py/path/svn/quoting.txt
py/path/svn/svncommon.py
py/path/svn/testing/__init__.py
py/path/svn/testing/repotest.dump
py/path/svn/testing/svntestbase.py
py/path/svn/testing/test_auth.py
py/path/svn/testing/test_test_repo.py
py/path/svn/testing/test_urlcommand.py
py/path/svn/testing/test_wccommand.py
py/path/svn/urlcommand.py
py/path/svn/wccommand.py
py/path/testing/__init__.py
py/path/testing/common.py
py/path/testing/fscommon.py
py/path/testing/test_api.py
py/process/__init__.py
py/process/cmdexec.py
py/process/testing/__init__.py
py/process/testing/test_cmdexec.py
py/rest/__init__.py
py/rest/convert.py
py/rest/directive.py
py/rest/latex.py
py/rest/rest.sty.template
py/rest/rst.py
py/rest/testing/__init__.py
py/rest/testing/data/example.rst2pdfconfig
py/rest/testing/data/example1.dot
py/rest/testing/data/formula.txt
py/rest/testing/data/formula1.txt
py/rest/testing/data/graphviz.txt
py/rest/testing/data/part1.txt
py/rest/testing/data/part2.txt
py/rest/testing/data/tocdepth.rst2pdfconfig
py/rest/testing/setup.py
py/rest/testing/test_convert.py
py/rest/testing/test_directive.py
py/rest/testing/test_htmlrest.py
py/rest/testing/test_rst.py
py/rest/testing/test_rst2pdf.py
py/rest/testing/test_transform.py
py/rest/transform.py
py/test/__init__.py
py/test/cmdline.py
py/test/collect.py
py/test/config.py
py/test/conftesthandle.py
py/test/defaultconftest.py
py/test/deprecate.py
py/test/doctest.py
py/test/item.py
py/test/outcome.py
py/test/raises.py
py/test/representation.py
py/test/rsession/__init__.py
py/test/rsession/box.py
py/test/rsession/executor.py
py/test/rsession/hostmanage.py
py/test/rsession/local.py
py/test/rsession/master.py
py/test/rsession/outcome.py
py/test/rsession/repevent.py
py/test/rsession/reporter.py
py/test/rsession/rest.py
py/test/rsession/rsession.py
py/test/rsession/slave.py
py/test/rsession/testing/__init__.py
py/test/rsession/testing/basetest.py
py/test/rsession/testing/example1.py
py/test/rsession/testing/example2.py
py/test/rsession/testing/test_boxing.py
py/test/rsession/testing/test_executor.py
py/test/rsession/testing/test_hostmanage.py
py/test/rsession/testing/test_lsession.py
py/test/rsession/testing/test_master.py
py/test/rsession/testing/test_outcome.py
py/test/rsession/testing/test_repevent.py
py/test/rsession/testing/test_reporter.py
py/test/rsession/testing/test_rest.py
py/test/rsession/testing/test_rsession.py
py/test/rsession/testing/test_slave.py
py/test/rsession/testing/test_web.py
py/test/rsession/testing/test_webjs.py
py/test/rsession/web.py
py/test/rsession/webdata/__init__.py
py/test/rsession/webdata/index.html
py/test/rsession/webdata/json.py
py/test/rsession/webdata/source.js
py/test/rsession/webjs.py
py/test/session.py
py/test/terminal/__init__.py
py/test/terminal/out.py
py/test/terminal/remote.py
py/test/terminal/terminal.py
py/test/testing/__init__.py
py/test/testing/import_test/package/__init__.py
py/test/testing/import_test/package/absolute_import_shared_lib.py
py/test/testing/import_test/package/module_that_imports_shared_lib.py
py/test/testing/import_test/package/shared_lib.py
py/test/testing/import_test/package/test_import.py
py/test/testing/setupdata.py
py/test/testing/test_collect.py
py/test/testing/test_config.py
py/test/testing/test_conftesthandle.py
py/test/testing/test_deprecated.py
py/test/testing/test_doctest.py
py/test/testing/test_raises.py
py/test/testing/test_remote.py
py/test/testing/test_repr.py
py/test/testing/test_session.py
py/test/testing/test_setup_nested.py
py/test/web/__init__.py
py/test/web/exception.py
py/test/web/post_multipart.py
py/test/web/webcheck.py
py/thread/__init__.py
py/thread/io.py
py/thread/pool.py
py/thread/testing/__init__.py
py/thread/testing/test_io.py
py/thread/testing/test_pool.py
py/tool/__init__.py
py/tool/testing/__init__.py
py/tool/testing/test_utestconvert.py
py/tool/utestconvert.py
py/xmlobj/__init__.py
py/xmlobj/html.py
py/xmlobj/misc.py
py/xmlobj/testing/__init__.py
py/xmlobj/testing/test_html.py
py/xmlobj/testing/test_xml.py
py/xmlobj/visit.py
py/xmlobj/xml.py
setup.py

20
README.txt Normal file
View File

@ -0,0 +1,20 @@
The py lib is a Python development support library featuring
the following tools and modules:
* py.test: popular python testing tool
* py.execnet: ad-hoc distributed execution
* py.magic.greenlet: micro-threads
* py.path: uniform local and svn path objects
It includes code and contributions from several people,
listed in the LICENSE file.
For questions, please see py/doc/index.txt, refer to the website
http://pylib.org or come to the #pylib IRC freenode channel or subscribe to
http://codespeak.net/mailman/listinfo/py-dev .
have fun,
holger krekel, holger at merlinux eu
$Id: README.txt 57429 2008-08-18 15:08:39Z hpk $

272
ez_setup.py Normal file
View File

@ -0,0 +1,272 @@
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import sys
DEFAULT_VERSION = "0.6c8"
DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
md5_data = {
'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
}
import sys, os
def _validate_md5(egg_name, data):
if egg_name in md5_data:
from md5 import md5
digest = md5(data).hexdigest()
if digest != md5_data[egg_name]:
print >>sys.stderr, (
"md5 validation of %s failed! (Possible download problem?)"
% egg_name
)
sys.exit(2)
return data
def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
):
"""Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end with
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
it is not already available. If `download_delay` is specified, it should
be the number of seconds that will be paused before initiating a download,
should one be required. If an older version of setuptools is installed,
this routine will print a message to ``sys.stderr`` and raise SystemExit in
an attempt to abort the calling script.
"""
was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
def do_download():
egg = download_setuptools(version, download_base, to_dir, download_delay)
sys.path.insert(0, egg)
import setuptools; setuptools.bootstrap_install_from = egg
try:
import pkg_resources
except ImportError:
return do_download()
try:
pkg_resources.require("setuptools>="+version); return
except pkg_resources.VersionConflict, e:
if was_imported:
print >>sys.stderr, (
"The required version of setuptools (>=%s) is not available, and\n"
"can't be installed while this script is running. Please install\n"
" a more recent version first, using 'easy_install -U setuptools'."
"\n\n(Currently using %r)"
) % (version, e.args[0])
sys.exit(2)
else:
del pkg_resources, sys.modules['pkg_resources'] # reload ok
return do_download()
except pkg_resources.DistributionNotFound:
return do_download()
def download_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
delay = 15
):
"""Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download attempt.
"""
import urllib2, shutil
egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
url = download_base + egg_name
saveto = os.path.join(to_dir, egg_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
from distutils import log
if delay:
log.warn("""
---------------------------------------------------------------------------
This script requires setuptools version %s to run (even to display
help). I will attempt to download it for you (from
%s), but
you may need to enable firewall access for this script first.
I will start the download in %d seconds.
(Note: if this machine does not have network access, please obtain the file
%s
and place it in this directory before rerunning this script.)
---------------------------------------------------------------------------""",
version, download_base, delay, url
); from time import sleep; sleep(delay)
log.warn("Downloading %s", url)
src = urllib2.urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = _validate_md5(egg_name, src.read())
dst = open(saveto,"wb"); dst.write(data)
finally:
if src: src.close()
if dst: dst.close()
return os.path.realpath(saveto)
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_install import main
return main(list(argv)+[egg]) # we're done here
finally:
if egg and os.path.exists(egg):
os.unlink(egg)
else:
if setuptools.__version__ == '0.0.1':
print >>sys.stderr, (
"You have an obsolete version of setuptools installed. Please\n"
"remove it from your system entirely before rerunning this script."
)
sys.exit(2)
req = "setuptools>="+version
import pkg_resources
try:
pkg_resources.require(req)
except pkg_resources.VersionConflict:
try:
from setuptools.command.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
else:
if argv:
from setuptools.command.easy_install import main
main(argv)
else:
print "Setuptools version",version,"or greater has been installed."
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
def update_md5(filenames):
"""Update our built-in md5 registry"""
import re
from md5 import md5
for name in filenames:
base = os.path.basename(name)
f = open(name,'rb')
md5_data[base] = md5(f.read()).hexdigest()
f.close()
data = [" %r: %r,\n" % it for it in md5_data.items()]
data.sort()
repl = "".join(data)
import inspect
srcfile = inspect.getsourcefile(sys.modules[__name__])
f = open(srcfile, 'rb'); src = f.read(); f.close()
match = re.search("\nmd5_data = {\n([^}]+)}", src)
if not match:
print >>sys.stderr, "Internal error!"
sys.exit(2)
src = src[:match.start(1)] + repl + src[match.end(1):]
f = open(srcfile,'w')
f.write(src)
f.close()
if __name__=='__main__':
if len(sys.argv)>2 and sys.argv[1]=='--md5update':
update_md5(sys.argv[2:])
else:
main(sys.argv[1:])

View File

@ -1,25 +1,28 @@
py lib Copyright holders, 2003-2005
py lib Copyright holders, 2003-2008
=======================================
Except when otherwise stated (look for LICENSE files or information at
the beginning of each file) the files in the 'py' directory are
copyrighted by one or more of the following people and organizations:
Holger Krekel <hpk@trillke.net>
merlinux GmbH, Germany <office@merlinux.de>
Armin Rigo <arigo@tunes.org>
Carl Friedrich Bolz <cfbolz@merlinux.de>
Maciek Fijalkowski <fijal@genesilico.pl>
Guido Wesdorp <guido@merlinux.de>
Jan Balster <jan@balster.info>
Holger Krekel, holger at merlinux eu
Guido Wesdorp, johnny at johnnydebris net
Carl Friedrich Bolz, cfbolz at gmx de
Armin Rigo, arigo at tunes org
Maciek Fijalkowski, fijal at genesilico.pl
Briand Dorsey, briandorsey at gmail com
merlinux GmbH, Germany, office at merlinux eu
Contributors include::
Ian Bicking <ianb@colorstudy.com>
Grig Gheorghiu <grig@gheorghiu.net>
Bob Ippolito <bob@redivi.com>
Christian Tismer <tismer@stackless.com>
Samuele Pedroni <pedronis@strakt.com>
Samuele Pedroni
Harald Armin Massa
Ralf Schmitt
Ian Bicking
Jan Balster
Grig Gheorghiu
Bob Ippolito
Christian Tismer
Except when otherwise stated (look for LICENSE files or information at
the beginning of each file) all files in the 'py' directory are

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""
the py lib is a development support library featuring
py.test, ad-hoc distributed execution, micro-threads
and svn abstractions.
the py lib is a development support library featuring
py.test, ad-hoc distributed execution, micro-threads
and svn abstractions.
"""
from initpkg import initpkg
@ -11,16 +11,30 @@ version = "1.0-pre-alpha"
initpkg(__name__,
description = "pylib and py.test: agile development and test support library",
revision = int('$LastChangedRevision: 57324 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2008-08-16 17:47:26 +0200 (Sat, 16 Aug 2008) $',
revision = int('$LastChangedRevision: 57429 $'.split(':')[1][:-1]),
lastchangedate = '$LastChangedDate: 2008-08-18 17:08:39 +0200 (Mon, 18 Aug 2008) $',
version = version,
url = "http://codespeak.net/py",
download_url = "XXX", # "http://codespeak.net/download/py/py-%s.tar.gz" %(version,),
url = "http://pylib.org",
download_url = "http://pypi.python.org/pypi?:action=display&name=py",
license = "MIT license",
platforms = ['unix', 'linux', 'cygwin', 'win32'],
author = "holger krekel, Carl Friedrich Bolz, Guido Wesdorp, Maciej Fijalkowski, Armin Rigo & others",
author_email = "py-dev@codespeak.net",
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, py-dev at codespeak.net",
long_description = globals()['__doc__'],
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Distributed Computing",
"Topic :: Utilities",
"Programming Language :: Python",
],
# EXPORTED API
exportdefs = {

View File

@ -8,6 +8,7 @@ from py.__.apigen.tracer import model
import sys
import py
def setup_module(mod):
sys.path.insert(0, str(py.path.local(__file__).dirpath().join("package")))
import submodule
@ -24,6 +25,8 @@ class TestFullModule(object):
def test_init(self):
ds = self.ds
print py.builtin.sorted(ds.descs.keys())
if sys.platform == "win32":
py.test.skip("not sure why, but this fails with 4 == 6")
assert len(ds.descs) == 6
assert py.builtin.sorted(ds.descs.keys()) == [
'notpak.notmod.notclass', 'notpak.notmod.notclass.__init__',

View File

@ -1,14 +0,0 @@
import py
class Directory(py.test.collect.Directory):
# XXX see in which situations/platforms we want
# run tests here
#def recfilter(self, path):
# if py.std.sys.platform == 'linux2':
# if path.basename == 'greenlet':
# return False
# return super(Directory, self).recfilter(path)
#def run(self):
# py.test.skip("c-extension testing needs platform selection")
pass

View File

@ -52,7 +52,9 @@ prepended.
Usage: ``py.rest [PATHS] [options]``
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).
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

24
py/doc/release-0.9.2.txt Normal file
View File

@ -0,0 +1,24 @@
py lib 0.9.2: bugfix release
=============================
Welcome to the 0.9.2 py lib and py.test release -
mainly fixing Windows issues, providing better
packaging and integration with setuptools.
Summary of main feature of the py lib:
* py.test: cross-project testing tool with many advanced features
* py.execnet: ad-hoc code distribution to SSH, Socket and local sub processes
* py.magic.greenlet: micro-threads on standard CPython ("stackless-light")
* py.path: path abstractions over local and subversion files
* rich documentation of py's exported API
* tested against Linux, Win32, OSX, works on python 2.3-2.6
See here for more information:
Download/Install: http://codespeak.net/py/0.9.2/download.html
Documentation/API: http://codespeak.net/py/0.9.2/index.html
best and have fun,
holger krekel

View File

@ -0,0 +1 @@
#

View File

@ -32,7 +32,7 @@ from types import ModuleType
# ---------------------------------------------------
class Package(object):
def __init__(self, name, exportdefs):
def __init__(self, name, exportdefs, metainfo):
pkgmodule = sys.modules[name]
assert pkgmodule.__name__ == name
self.name = name
@ -54,6 +54,13 @@ class Package(object):
# inhibit further direct filesystem imports through the package module
del pkgmodule.__path__
# set metainfo
for name, value in metainfo.items():
setattr(self, name, value)
version = metainfo.get('version', None)
if version:
pkgmodule.__version__ = version
def _resolve(self, extpyish):
""" resolve a combined filesystem/python extpy-ish path. """
fspath, modpath = extpyish
@ -229,9 +236,7 @@ class Module(ModuleType):
def initpkg(pkgname, exportdefs, **kw):
#print "initializing package", pkgname
# bootstrap Package object
pkg = Package(pkgname, exportdefs)
for name, value in kw.items():
setattr(pkg, name, value)
pkg = Package(pkgname, exportdefs, kw)
seen = { pkgname : pkg.module }
deferred_imports = []

View File

@ -32,7 +32,7 @@ def make_module_from_c(cfile):
lib = dirpath.join(modname+ext)
# XXX argl! we need better "build"-locations alltogether!
if lib.check():
if lib.check() and lib.stat().mtime < cfile.stat().mtime:
try:
lib.remove()
except EnvironmentError:

View File

@ -255,13 +255,3 @@ class TestRealModule:
# help(std.path)
# #assert False
def test_url_of_version():
#py.test.skip("FAILING! - provide a proper URL or upload pylib tgz")
from urllib import URLopener
url = py.__pkg__.download_url
if url.lower() == "xxx":
assert py.__pkg__.version.find("alpha") != -1
else:
URLopener().open(url)

View File

@ -1,75 +0,0 @@
import py
import sys
here = py.magic.autopath().dirpath()
update_website = here.join('../../bin/_update_website.py').pyimport()
def test_rsync():
temp = py.test.ensuretemp('update_website_rsync')
pkgpath = temp.join('pkg')
apipath = temp.join('apigen')
pkgpath.ensure('foo/bar.txt', file=True).write('baz')
pkgpath.ensure('spam/eggs.txt', file=True).write('spam')
apipath.ensure('api/foo.html', file=True).write('<html />')
apipath.ensure('source/spam.html', file=True).write('<html />')
rsyncpath = temp.join('rsync')
assert not rsyncpath.check()
gateway = py.execnet.PopenGateway()
update_website.rsync(pkgpath, apipath, gateway, rsyncpath.strpath)
assert rsyncpath.check(dir=True)
assert rsyncpath.join('pkg').check(dir=True)
assert rsyncpath.join('pkg/spam/eggs.txt').read() == 'spam'
assert rsyncpath.join('apigen').check(dir=True)
assert rsyncpath.join('apigen/api/foo.html').read() == '<html />'
def setup_pkg(testname):
temp = py.test.ensuretemp(testname)
pkgpath = temp.ensure('pkg', dir=True)
pyfile = pkgpath.ensure('mod.py').write(py.code.Source("""
def foo(x):
return x + 1
"""))
testfile = pkgpath.ensure('test/test_mod.py').write(py.code.Source("""
from pkg.sub import foo
def test_foo():
assert foo(1) == 2
"""))
initfile = pkgpath.ensure('__init__.py').write(py.code.Source("""
import py
from py.__.initpkg import initpkg
initpkg(__name__, exportdefs={
'sub.foo': ('./mod.py', 'foo'),
})
"""))
initfile = pkgpath.ensure('apigen/apigen.py').write(py.code.Source("""
from py.__.apigen.apigen import build, \
get_documentable_items_pkgdir as get_documentable_items
"""))
return pkgpath
def test_run_tests():
if py.std.sys.platform == "win32":
py.test.skip("update_website is not supposed to be run from win32")
pkgpath = setup_pkg('update_website_run_tests')
errors = update_website.run_tests(pkgpath,
pkgpath.dirpath().join('apigen'),
captureouterr=True)
print errors
assert not errors
py.test.skip("Apigen turned off")
assert pkgpath.join('../apigen').check(dir=True)
assert pkgpath.join('../apigen/api/sub.foo.html').check(file=True)
def test_run_tests_failure():
if py.std.sys.platform == "win32":
py.test.skip("update_website is not supposed to be run from win32")
pkgpath = setup_pkg('update_website_run_tests_failure')
assert not pkgpath.join('../apigen').check(dir=True)
py.test.skip("Apigen turned off")
pkgpath.ensure('../apigen', file=True)
errors = update_website.run_tests(pkgpath,
pkgpath.dirpath().join('apigen'),
captureouterr=True)
assert errors # some error message

10
py/rest/testing/setup.py Normal file
View File

@ -0,0 +1,10 @@
import py
pydir = py.path.local(py.__file__).dirpath()
mydatadir = py.magic.autopath().dirpath().join("data")
def getdata():
rel = mydatadir.relto(pydir)
tmpdir = py.test.ensuretemp(rel.replace(pydir.sep, '_'))
mydatadir.copy(tmpdir)
return tmpdir

View File

@ -1,13 +1,13 @@
import py
from py.__.rest.convert import convert_dot, latexformula2png
datadir = py.magic.autopath().dirpath().join("data")
from py.__.rest.testing.setup import getdata
def setup_module(mod):
required = 'gs', 'dot', 'latex', 'epstopdf',
for exe in required:
if not py.path.local.sysfind(exe):
py.test.skip("%r not found, required: %r" %(exe, required))
mod.datadir = getdata()
def test_convert_dot():
# XXX not really clear that the result is valid pdf/eps

View File

@ -7,9 +7,11 @@ except ImportError:
from py.__.rest import directive
from py.__.misc import rest
from py.__.rest.latex import process_rest_file
from py.__.rest.testing.setup import getdata
datadir = py.magic.autopath().dirpath().join("data")
testdir = py.test.ensuretemp("rest")
def setup_module(mod):
mod.datadir = getdata()
mod.testdir = py.test.ensuretemp("rest")
class TestGraphviz(object):
def _graphviz_html(self):

View File

@ -2,6 +2,7 @@ from __future__ import generators
import py
from py.__.misc import rest
from py.__.rest.testing.setup import getdata
def setup_module(mod):
if not py.path.local.sysfind("gs") or \
@ -13,12 +14,12 @@ def setup_module(mod):
except ImportError:
py.test.skip("docutils not present")
data = py.magic.autopath().dirpath().join("data")
mod.datadir = getdata()
def test_process_simple():
# fallback test: only checks that no exception is raised
def rec(p):
return p.check(dotfile=0)
for x in data.visit("*.txt", rec=rec):
for x in datadir.visit("*.txt", rec=rec):
yield rest.process, x

View File

@ -2,6 +2,8 @@ from __future__ import generators
import py
from py.__.rest.latex import process_configfile, process_rest_file
from py.__.rest.testing.setup import getdata
try:
import docutils
except ImportError:
@ -13,22 +15,20 @@ def setup_module(mod):
not py.path.local.sysfind("dot") or \
not py.path.local.sysfind("latex"):
py.test.skip("ghostscript, graphviz and latex needed")
mod.data = py.magic.autopath().dirpath().join("data")
mod.datadir = getdata()
class TestRst2Pdf(object):
def _process_rest_file(self):
data = py.magic.autopath().dirpath().join("data")
part2 = data.join("part1.txt")
part2 = datadir.join("part1.txt")
pdf = part2.new(ext="pdf")
process_rest_file(part2)
assert pdf.check()
pdf.remove()
def _process_configfile(self):
data = py.magic.autopath().dirpath().join("data")
config = data.join("example.rst2pdfconfig")
config = datadir.join("example.rst2pdfconfig")
pdf = config.new(ext="pdf")
tex = data.join('example.tex')
tex = datadir.join('example.tex')
process_configfile(config, debug=True)
assert pdf.check()
assert tex.check()
@ -45,9 +45,9 @@ class TestRst2Pdf(object):
def rec(p):
return p.check(dotfile=0)
for x in data.visit("*.rst2pdfconfig", rec=rec):
for x in datadir.visit("*.rst2pdfconfig", rec=rec):
process_configfile(x)
for x in data.visit("*.txt", rec=rec):
for x in datadir.visit("*.txt", rec=rec):
process_rest_file(x)
def test_rst2pdf(self):

210
setup.py
View File

@ -1,3 +1,207 @@
import py
from py.__.misc._dist import setup
setup(py)
"""
setup file for 'py' package based on:
https://codespeak.net/svn/py/release/0.9.x, revision=57387
autogenerated by gensetup.py
"""
import os, sys
if 1: # set to zero if you want plain distutils
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, Extension
else:
from distutils.core import setup, Extension
def main():
setup(cmdclass=cmdclass,
name='py',
description='py lib: agile development and test support library',
version='0.9.2-alpha-6',
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, py-dev at codespeak.net',
ext_modules = [Extension("py.c-extension.greenlet.greenlet",
["py/c-extension/greenlet/greenlet.c"]),],
py_modules=['_findpy'],
long_description='the py lib is a development support library featuring py.test, ad-hoc distributed execution, micro-threads and svn abstractions.',
classifiers=['Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Software Development :: Testing',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Distributed Computing',
'Topic :: Utilities',
'Programming Language :: Python'],
scripts=['py/bin/py.cleanup',
'py/bin/py.countloc',
'py/bin/py.lookup',
'py/bin/py.rest',
'py/bin/py.test'],
packages=['py',
'py.apigen',
'py.apigen.rest',
'py.apigen.rest.testing',
'py.apigen.source',
'py.apigen.source.testing',
'py.apigen.testing',
'py.apigen.tracer',
'py.apigen.tracer.testing',
'py.apigen.tracer.testing.package',
'py.apigen.tracer.testing.package.submodule',
'py.apigen.tracer.testing.package.submodule.pak',
'py.builtin',
'py.builtin.testing',
'py.code',
'py.code.testing',
'py.compat',
'py.compat.testing',
'py.doc',
'py.execnet',
'py.execnet.script',
'py.execnet.testing',
'py.io',
'py.io.test',
'py.log',
'py.log.testing',
'py.magic',
'py.magic.testing',
'py.misc',
'py.misc.cmdline',
'py.misc.testing',
'py.path',
'py.path.gateway',
'py.path.local',
'py.path.local.testing',
'py.path.svn',
'py.path.svn.testing',
'py.path.testing',
'py.process',
'py.process.testing',
'py.rest',
'py.rest.testing',
'py.test',
'py.test.rsession',
'py.test.rsession.testing',
'py.test.rsession.webdata',
'py.test.terminal',
'py.test.testing',
'py.test.testing.import_test.package',
'py.test.web',
'py.thread',
'py.thread.testing',
'py.tool',
'py.tool.testing',
'py.xmlobj',
'py.xmlobj.testing'],
package_data={'py': ['LICENSE',
'apigen/api.js',
'apigen/apigen.js',
'apigen/source/index.cgi',
'apigen/style.css',
'apigen/todo-apigen.txt',
'apigen/todo.txt',
'bin/py.cleanup',
'bin/py.countloc',
'bin/py.lookup',
'bin/py.rest',
'bin/py.test',
'c-extension/greenlet/README.txt',
'c-extension/greenlet/greenlet.c',
'c-extension/greenlet/greenlet.h',
'c-extension/greenlet/slp_platformselect.h',
'c-extension/greenlet/switch_amd64_unix.h',
'c-extension/greenlet/switch_ppc_macosx.h',
'c-extension/greenlet/switch_ppc_unix.h',
'c-extension/greenlet/switch_s390_unix.h',
'c-extension/greenlet/switch_sparc_sun_gcc.h',
'c-extension/greenlet/switch_x86_msvc.h',
'c-extension/greenlet/switch_x86_unix.h',
'compat/LICENSE',
'compat/testing/test_doctest.txt',
'compat/testing/test_doctest2.txt',
'doc/TODO.txt',
'doc/apigen.txt',
'doc/bin.txt',
'doc/code.txt',
'doc/coding-style.txt',
'doc/contact.txt',
'doc/download.txt',
'doc/execnet.txt',
'doc/future.txt',
'doc/future/code_template.txt',
'doc/future/planning.txt',
'doc/future/pylib_pypy.txt',
'doc/future/rsession_todo.txt',
'doc/greenlet.txt',
'doc/impl-test.txt',
'doc/index.txt',
'doc/io.txt',
'doc/links.txt',
'doc/log.txt',
'doc/misc.txt',
'doc/path.txt',
'doc/release-0.9.0.txt',
'doc/release-0.9.1.txt',
'doc/release-0.9.2.txt',
'doc/style.css',
'doc/test.txt',
'doc/why_py.txt',
'doc/xml.txt',
'env.cmd',
'execnet/NOTES',
'misc/testing/data/svnlookrepo.dump',
'path/gateway/TODO.txt',
'path/svn/quoting.txt',
'path/svn/testing/repotest.dump',
'rest/rest.sty.template',
'rest/testing/data/example.rst2pdfconfig',
'rest/testing/data/example1.dot',
'rest/testing/data/formula.txt',
'rest/testing/data/formula1.txt',
'rest/testing/data/graphviz.txt',
'rest/testing/data/part1.txt',
'rest/testing/data/part2.txt',
'rest/testing/data/tocdepth.rst2pdfconfig',
'test/rsession/webdata/index.html',
'test/rsession/webdata/source.js']},
zip_safe=False,
)
# on windows we need to hack up the to-be-installed scripts
from distutils.command.install_scripts import install_scripts
class my_install_scripts(install_scripts):
def run(self):
install_scripts.run(self)
#print self.outfiles
for fn in self.outfiles:
basename = os.path.basename(fn)
if "." in basename:
#print "tackling", fn
newbasename = basename.replace(".", "_")
newfn = os.path.join(os.path.dirname(fn), newbasename)
if os.path.exists(newfn):
os.remove(newfn)
os.rename(fn, newfn)
newname = fn + ".cmd"
if os.path.exists(newname):
os.remove(newname)
f = open(newname, 'w')
f.write("@echo off\n")
f.write('python "%%~dp0\%s" %%*\n' % newbasename)
f.close()
if sys.platform == "win32":
cmdclass = {'install_scripts': my_install_scripts}
else:
cmdclass = {}
if __name__ == '__main__':
main()