[svn r51329] rename special __package__ to __pkg__ because python 2.6 needs the former
(thanks to Ralf Schmitt) --HG-- branch : trunk
This commit is contained in:
parent
37d357ff4c
commit
f3f84fa36c
|
@ -16,7 +16,7 @@ from py.__.apigen.tracer import model
|
|||
sorted = py.builtin.sorted
|
||||
|
||||
def pkg_to_dict(module):
|
||||
defs = module.__package__.exportdefs
|
||||
defs = module.__pkg__.exportdefs
|
||||
d = {}
|
||||
for key, value in defs.iteritems():
|
||||
chain = key.split('.')
|
||||
|
@ -33,7 +33,7 @@ def get_star_import_tree(module, modname):
|
|||
""" deal with '*' entries in an initpkg situation """
|
||||
ret = {}
|
||||
modpath = py.path.local(inspect.getsourcefile(module))
|
||||
pkgpath = module.__package__.getpath()
|
||||
pkgpath = module.__pkg__.getpath()
|
||||
for objname in dir(module):
|
||||
if objname.startswith('_'):
|
||||
continue # also skip __*__ attributes
|
||||
|
@ -281,8 +281,8 @@ class DocStorageAccessor(AbstractDocStorageAccessor):
|
|||
return "Lack of module info"
|
||||
try:
|
||||
retval = module.__doc__ or "*undocumented*"
|
||||
retval = module.__package__.description
|
||||
retval = module.__package__.long_description
|
||||
retval = module.__pkg__.description
|
||||
retval = module.__pkg__.long_description
|
||||
except AttributeError:
|
||||
pass
|
||||
return retval
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
from _findpy import py
|
||||
import py
|
||||
pypath = py.__package__.getpath()
|
||||
pypath = py.__pkg__.getpath()
|
||||
|
||||
def run_tests(path, envvars='', args=''):
|
||||
pytestpath = pypath.join('bin/py.test')
|
||||
|
|
|
@ -147,9 +147,9 @@ def pytest_remote(address, url):
|
|||
if __name__ == '__main__':
|
||||
py.magic.invoke(assertion=True)
|
||||
version = py.std.sys.argv[1]
|
||||
assert py.__package__.version == version, (
|
||||
assert py.__pkg__.version == version, (
|
||||
"py package has version %s\nlocation: %s" %
|
||||
(py.__package__.version, pydir))
|
||||
(py.__pkg__.version, pydir))
|
||||
|
||||
tmpdir = py.path.local.get_temproot().join('makepyrelease-%s' % version)
|
||||
if tmpdir.check():
|
||||
|
@ -171,14 +171,14 @@ if __name__ == '__main__':
|
|||
py.process.cmdexec("rsync -avz %(source)s/ %(remotedir)s" % locals())
|
||||
|
||||
ddir = tmpdir.ensure('download', dir=1)
|
||||
URL = py.__package__.download_url # 'http://codespeak.net/download/py/'
|
||||
URL = py.__pkg__.download_url # 'http://codespeak.net/download/py/'
|
||||
unpacked = unpackremotetar(ddir, URL)
|
||||
assert unpacked == ddir.join("py-%s" % (version,))
|
||||
|
||||
#checksvnworks(unpacked)
|
||||
#pytest(unpacked)
|
||||
|
||||
pytest_remote('test@codespeak.net', py.__package__.download_url)
|
||||
pytest_remote('test@codespeak.net', py.__pkg__.download_url)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ def rsync(pkgpath, apidocspath, gateway, remotepath):
|
|||
|
||||
def run_tests(pkgpath, apigenpath, args='', captureouterr=False):
|
||||
""" run the unit tests and build the docs """
|
||||
pypath = py.__package__.getpath()
|
||||
pypath = py.__pkg__.getpath()
|
||||
pytestpath = pypath.join('bin/py.test')
|
||||
# XXX this would need a Windows specific version if we want to allow
|
||||
# running this script on that platform, but currently --apigen doesn't
|
||||
|
@ -82,7 +82,7 @@ if __name__ == '__main__':
|
|||
args.remove('--ignorefail')
|
||||
ignorefail = True
|
||||
args = ' '.join(sys.argv[1:])
|
||||
pkgpath = py.__package__.getpath()
|
||||
pkgpath = py.__pkg__.getpath()
|
||||
apidocspath = pkgpath.dirpath().join('apigen')
|
||||
main(pkgpath, apidocspath, 'codespeak.net',
|
||||
'/home/guido/rsynctests', args, ignorefail)
|
||||
|
|
|
@ -39,10 +39,12 @@ py.apigen
|
|||
|
||||
- refactor to produce intermediate data/files capturing
|
||||
info of test runs
|
||||
|
||||
- refactor html renderer to work on intermediate
|
||||
data/files rather than on the live data
|
||||
|
||||
- check out CodeInvestigator
|
||||
http://codeinvestigator.googlepages.com/main
|
||||
|
||||
|
||||
ld (review and shift to above)
|
||||
=================================
|
||||
|
|
|
@ -311,7 +311,7 @@ def resolve_linkrole(name, text, check=True):
|
|||
'to the py package') % (text,)
|
||||
relpath = '/'.join(text.split('/')[1:])
|
||||
if check:
|
||||
pkgroot = py.__package__.getpath()
|
||||
pkgroot = py.__pkg__.getpath()
|
||||
abspath = pkgroot.join(relpath)
|
||||
assert pkgroot.join(relpath).check(), (
|
||||
'problem with linkrole :source:`%s`: '
|
||||
|
|
|
@ -38,9 +38,9 @@ class Package(object):
|
|||
self.name = name
|
||||
self.exportdefs = exportdefs
|
||||
self.module = pkgmodule
|
||||
assert not hasattr(pkgmodule, '__package__'), \
|
||||
assert not hasattr(pkgmodule, '__pkg__'), \
|
||||
"unsupported reinitialization of %r" % pkgmodule
|
||||
pkgmodule.__package__ = self
|
||||
pkgmodule.__pkg__ = self
|
||||
|
||||
# make available pkgname.__
|
||||
implname = name + '.' + '__'
|
||||
|
@ -134,7 +134,7 @@ class Package(object):
|
|||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
base = py.__package__.getpath().dirpath()
|
||||
base = py.__pkg__.getpath().dirpath()
|
||||
outf = StringIO()
|
||||
f = zipfile.ZipFile(outf, 'w', compression=zipfile.ZIP_DEFLATED)
|
||||
try:
|
||||
|
@ -164,14 +164,14 @@ def setmodule(modpath, module):
|
|||
|
||||
class Module(ModuleType):
|
||||
def __init__(self, pkg, name):
|
||||
self.__package__ = pkg
|
||||
self.__pkg__ = pkg
|
||||
self.__name__ = name
|
||||
self.__map__ = {}
|
||||
|
||||
def __getattr__(self, name):
|
||||
if '*' in self.__map__:
|
||||
extpy = self.__map__['*'][0], name
|
||||
result = self.__package__._resolve(extpy)
|
||||
result = self.__pkg__._resolve(extpy)
|
||||
else:
|
||||
try:
|
||||
extpy = self.__map__[name]
|
||||
|
@ -179,7 +179,7 @@ class Module(ModuleType):
|
|||
__tracebackhide__ = True
|
||||
raise AttributeError(name)
|
||||
else:
|
||||
result = self.__package__._resolve(extpy)
|
||||
result = self.__pkg__._resolve(extpy)
|
||||
del self.__map__[name]
|
||||
setattr(self, name, result)
|
||||
#self._fixinspection(result, name)
|
||||
|
@ -216,7 +216,7 @@ class Module(ModuleType):
|
|||
assert not self.__map__, "%r not empty" % self.__map__
|
||||
else:
|
||||
fsname = self.__map__['*'][0]
|
||||
dict.update(self.__package__._loadimpl(fsname[:-3]).__dict__)
|
||||
dict.update(self.__pkg__._loadimpl(fsname[:-3]).__dict__)
|
||||
return dict
|
||||
|
||||
__dict__ = property(getdict)
|
||||
|
|
|
@ -144,7 +144,7 @@ def setup(pkg, **kw):
|
|||
|
||||
params = Params(pkg)
|
||||
#dump(params)
|
||||
source = getattr(pkg, '__package__', pkg)
|
||||
source = getattr(pkg, '__pkg__', pkg)
|
||||
namelist = list(core.setup_keywords)
|
||||
namelist.extend(['packages', 'scripts', 'data_files'])
|
||||
for name in namelist:
|
||||
|
|
|
@ -33,7 +33,7 @@ def test_early__dict__access():
|
|||
|
||||
def test_resolve_attrerror():
|
||||
extpyish = "./initpkg.py", "hello"
|
||||
excinfo = py.test.raises(AttributeError, "py.__package__._resolve(extpyish)")
|
||||
excinfo = py.test.raises(AttributeError, "py.__pkg__._resolve(extpyish)")
|
||||
s = str(excinfo.value)
|
||||
assert s.find(extpyish[0]) != -1
|
||||
assert s.find(extpyish[1]) != -1
|
||||
|
@ -83,16 +83,16 @@ def check_import(modpath):
|
|||
assert __import__(modpath)
|
||||
|
||||
def test_shahexdigest():
|
||||
hex = py.__package__.shahexdigest()
|
||||
hex = py.__pkg__.shahexdigest()
|
||||
assert len(hex) == 40
|
||||
|
||||
def test_getzipdata():
|
||||
s = py.__package__.getzipdata()
|
||||
s = py.__pkg__.getzipdata()
|
||||
|
||||
def test_getrev():
|
||||
if not py.path.local(py.__file__).dirpath('.svn').check():
|
||||
py.test.skip("py package is not a svn checkout")
|
||||
d = py.__package__.getrev()
|
||||
d = py.__pkg__.getrev()
|
||||
svnversion = py.path.local.sysfind('svnversion')
|
||||
if svnversion is None:
|
||||
py.test.skip("cannot test svnversion, 'svnversion' binary not found")
|
||||
|
@ -255,9 +255,9 @@ class TestRealModule:
|
|||
def test_url_of_version():
|
||||
#py.test.skip("FAILING! - provide a proper URL or upload pylib tgz")
|
||||
from urllib import URLopener
|
||||
url = py.__package__.download_url
|
||||
url = py.__pkg__.download_url
|
||||
if url.lower() == "xxx":
|
||||
assert py.__package__.version.find("alpha") != -1
|
||||
assert py.__pkg__.version.find("alpha") != -1
|
||||
else:
|
||||
URLopener().open(url)
|
||||
|
||||
|
|
|
@ -400,8 +400,8 @@ class LocalPath(common.FSPathBase, PlatformMixin):
|
|||
self._prependsyspath(pkgpath.dirpath())
|
||||
pkg = __import__(pkgpath.basename, None, None, [])
|
||||
|
||||
if hasattr(pkg, '__package__'):
|
||||
modname = pkg.__package__.getimportname(self)
|
||||
if hasattr(pkg, '__pkg__'):
|
||||
modname = pkg.__pkg__.getimportname(self)
|
||||
assert modname is not None, "package %s doesn't know %s" % (
|
||||
pkg.__name__, self)
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ class LocalReporter(AbstractReporter):
|
|||
self.timestart = item.timestart
|
||||
self.out.line("executable: %s (%s)" %
|
||||
(py.std.sys.executable, repr_pythonversion()))
|
||||
rev = py.__package__.getrev()
|
||||
rev = py.__pkg__.getrev()
|
||||
self.out.line("using py lib: %s <rev %s>" % (
|
||||
py.path.local(py.__file__).dirpath(), rev))
|
||||
config = item.config
|
||||
|
|
Loading…
Reference in New Issue