[py-svn] r51329 - in py/trunk/py: . apigen/tracer bin doc misc misc/testing path/local test

hpk at codespeak.net hpk at codespeak.net
Fri Feb 8 09:43:07 CET 2008


Author: hpk
Date: Fri Feb  8 09:43:05 2008
New Revision: 51329

Modified:
   py/trunk/py/apigen/tracer/docstorage.py
   py/trunk/py/bin/_docgen.py
   py/trunk/py/bin/_makepyrelease.py
   py/trunk/py/bin/_update_website.py
   py/trunk/py/doc/TODO.txt
   py/trunk/py/doc/conftest.py
   py/trunk/py/initpkg.py
   py/trunk/py/misc/_dist.py
   py/trunk/py/misc/testing/test_initpkg.py
   py/trunk/py/path/local/local.py
   py/trunk/py/test/reporter.py
Log:
rename special __package__ to __pkg__ because python 2.6 needs the former 
(thanks to Ralf Schmitt)


Modified: py/trunk/py/apigen/tracer/docstorage.py
==============================================================================
--- py/trunk/py/apigen/tracer/docstorage.py	(original)
+++ py/trunk/py/apigen/tracer/docstorage.py	Fri Feb  8 09:43:05 2008
@@ -16,7 +16,7 @@
 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 @@
     """ 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 @@
             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

Modified: py/trunk/py/bin/_docgen.py
==============================================================================
--- py/trunk/py/bin/_docgen.py	(original)
+++ py/trunk/py/bin/_docgen.py	Fri Feb  8 09:43:05 2008
@@ -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')

Modified: py/trunk/py/bin/_makepyrelease.py
==============================================================================
--- py/trunk/py/bin/_makepyrelease.py	(original)
+++ py/trunk/py/bin/_makepyrelease.py	Fri Feb  8 09:43:05 2008
@@ -147,9 +147,9 @@
 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 @@
     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 at codespeak.net', py.__package__.download_url)
+    pytest_remote('test at codespeak.net', py.__pkg__.download_url)
 
 
 

Modified: py/trunk/py/bin/_update_website.py
==============================================================================
--- py/trunk/py/bin/_update_website.py	(original)
+++ py/trunk/py/bin/_update_website.py	Fri Feb  8 09:43:05 2008
@@ -24,7 +24,7 @@
 
 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 @@
         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)

Modified: py/trunk/py/doc/TODO.txt
==============================================================================
--- py/trunk/py/doc/TODO.txt	(original)
+++ py/trunk/py/doc/TODO.txt	Fri Feb  8 09:43:05 2008
@@ -39,10 +39,12 @@
 
 - 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)
 =================================

Modified: py/trunk/py/doc/conftest.py
==============================================================================
--- py/trunk/py/doc/conftest.py	(original)
+++ py/trunk/py/doc/conftest.py	Fri Feb  8 09:43:05 2008
@@ -311,7 +311,7 @@
                                         '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`: '

Modified: py/trunk/py/initpkg.py
==============================================================================
--- py/trunk/py/initpkg.py	(original)
+++ py/trunk/py/initpkg.py	Fri Feb  8 09:43:05 2008
@@ -38,9 +38,9 @@
         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 @@
             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 @@
 
 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 @@
                 __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 @@
                 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)

Modified: py/trunk/py/misc/_dist.py
==============================================================================
--- py/trunk/py/misc/_dist.py	(original)
+++ py/trunk/py/misc/_dist.py	Fri Feb  8 09:43:05 2008
@@ -144,7 +144,7 @@
 
     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: 

Modified: py/trunk/py/misc/testing/test_initpkg.py
==============================================================================
--- py/trunk/py/misc/testing/test_initpkg.py	(original)
+++ py/trunk/py/misc/testing/test_initpkg.py	Fri Feb  8 09:43:05 2008
@@ -33,7 +33,7 @@
     
 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 @@
     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 @@
 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) 
     

Modified: py/trunk/py/path/local/local.py
==============================================================================
--- py/trunk/py/path/local/local.py	(original)
+++ py/trunk/py/path/local/local.py	Fri Feb  8 09:43:05 2008
@@ -400,8 +400,8 @@
                     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)
                 

Modified: py/trunk/py/test/reporter.py
==============================================================================
--- py/trunk/py/test/reporter.py	(original)
+++ py/trunk/py/test/reporter.py	Fri Feb  8 09:43:05 2008
@@ -356,7 +356,7 @@
         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


More information about the py-svn mailing list