Changeset 460

Show
Ignore:
Timestamp:
Wed May 14 13:13:47 2008
Author:
naufraghi
Message:

Merged revisions 447-449 via svnmerge from
https://svn.pyinstaller.python-hosting.com/trunk[[BR]]
................

r449 | naufraghi | 2008-04-30 16:30:09 +0200 (Wed, 30 Apr 2008) | 399 lines

Merged revisions 342-393,401-404,413,424,426-427,429-433,435-437,439-442,445,448 via svnmerge from
https://svn.pyinstaller.python-hosting.com/branches/python2.5[[BR]]
........

r342 | naufraghi | 2007-12-03 20:02:47 +0100 (Lun, 03 Dic 2007) | 5 lines

r238@rosen: naufraghi | 2007-12-03 19:59:24 +0100
r200@rosen: naufraghi | 2007-11-23 15:54:13 +0100
Cleanup, remove some warning

........

r343 | naufraghi | 2007-12-03 20:02:56 +0100 (Lun, 03 Dic 2007) | 5 lines

r239@rosen: naufraghi | 2007-12-03 19:59:24 +0100
r201@rosen: naufraghi | 2007-11-23 17:23:15 +0100
Allow starting runtests from any path

........

r344 | naufraghi | 2007-12-03 20:03:04 +0100 (Lun, 03 Dic 2007) | 5 lines

r240@rosen: naufraghi | 2007-12-03 20:00:51 +0100
r202@rosen: naufraghi | 2007-11-23 17:24:17 +0100
Add natural sort for tests

........

r345 | naufraghi | 2007-12-03 20:03:12 +0100 (Lun, 03 Dic 2007) | 5 lines

r241@rosen: naufraghi | 2007-12-03 20:00:51 +0100
r203@rosen: naufraghi | 2007-11-23 17:32:46 +0100
Fix some fragile import?

........

r346 | naufraghi | 2007-12-03 20:03:21 +0100 (Lun, 03 Dic 2007) | 5 lines

r242@rosen: naufraghi | 2007-12-03 20:01:01 +0100
r204@rosen: naufraghi | 2007-11-23 17:46:41 +0100
Adds a basic way to choose tests to run

........

r347 | naufraghi | 2007-12-03 20:03:29 +0100 (Lun, 03 Dic 2007) | 5 lines

r243@rosen: naufraghi | 2007-12-03 20:01:04 +0100
r205@rosen: naufraghi | 2007-11-23 17:57:31 +0100
Adds and xml.dom test

........

r348 | naufraghi | 2007-12-03 20:03:38 +0100 (Lun, 03 Dic 2007) | 5 lines

r244@rosen: naufraghi | 2007-12-03 20:01:04 +0100
r206@rosen: naufraghi | 2007-11-23 18:05:04 +0100
Remove cmd line quoting

........

r349 | naufraghi | 2007-12-03 20:03:46 +0100 (Lun, 03 Dic 2007) | 5 lines

r245@rosen: naufraghi | 2007-12-03 20:01:06 +0100
r207@rosen: naufraghi | 2007-11-23 19:47:13 +0100
Adds 'import os' in one specfile

........

r350 | naufraghi | 2007-12-03 20:03:54 +0100 (Lun, 03 Dic 2007) | 5 lines

r246@rosen: naufraghi | 2007-12-03 20:01:08 +0100
r208@rosen: naufraghi | 2007-11-23 19:49:21 +0100
Add an 'encoding' hiddeimport test

........

r351 | naufraghi | 2007-12-03 20:04:05 +0100 (Lun, 03 Dic 2007) | 5 lines

r248@rosen: naufraghi | 2007-12-03 20:01:08 +0100
r211@rosen: naufraghi | 2007-11-27 16:13:30 +0100
Rewrite exec in execfile

........

r352 | naufraghi | 2007-12-03 20:04:15 +0100 (Lun, 03 Dic 2007) | 5 lines

r250@rosen: naufraghi | 2007-12-03 20:01:09 +0100
r214@rosen: naufraghi | 2007-11-30 11:49:23 +0100
Adds support for extended path

........

r353 | naufraghi | 2007-12-03 20:04:23 +0100 (Lun, 03 Dic 2007) | 5 lines

r251@rosen: naufraghi | 2007-12-03 20:01:13 +0100
r215@rosen: naufraghi | 2007-11-30 11:52:18 +0100
Simplify execfile

........

r354 | naufraghi | 2007-12-03 20:04:30 +0100 (Lun, 03 Dic 2007) | 5 lines

r252@rosen: naufraghi | 2007-12-03 20:01:15 +0100
r216@rosen: naufraghi | 2007-11-30 11:52:56 +0100
Fix output path

........

r355 | naufraghi | 2007-12-03 20:04:38 +0100 (Lun, 03 Dic 2007) | 5 lines

r253@rosen: naufraghi | 2007-12-03 20:01:16 +0100
r217@rosen: naufraghi | 2007-11-30 12:13:17 +0100
Add optional logging of self.moduleds

........

r356 | naufraghi | 2007-12-03 20:04:46 +0100 (Lun, 03 Dic 2007) | 5 lines

r254@rosen: naufraghi | 2007-12-03 20:01:16 +0100
r218@rosen: naufraghi | 2007-11-30 12:19:13 +0100
Add str at Module class (and adds a default file too)

........

r357 | naufraghi | 2007-12-03 20:04:54 +0100 (Lun, 03 Dic 2007) | 5 lines

r255@rosen: naufraghi | 2007-12-03 20:01:18 +0100
r219@rosen: naufraghi | 2007-11-30 12:30:19 +0100
Add version info to log filename

........

r358 | naufraghi | 2007-12-03 20:05:01 +0100 (Lun, 03 Dic 2007) | 5 lines

r256@rosen: naufraghi | 2007-12-03 20:01:19 +0100
r220@rosen: naufraghi | 2007-11-30 16:11:07 +0100
Asset-ize a comment + cosmetics (align variable name to other scopes)

........

r359 | naufraghi | 2007-12-03 20:05:09 +0100 (Lun, 03 Dic 2007) | 5 lines

r257@rosen: naufraghi | 2007-12-03 20:01:21 +0100
r221@rosen: naufraghi | 2007-11-30 16:46:17 +0100
Add comments and a None-iti assert

........

r360 | naufraghi | 2007-12-03 20:05:16 +0100 (Lun, 03 Dic 2007) | 5 lines

r258@rosen: naufraghi | 2007-12-03 20:01:24 +0100
r222@rosen: naufraghi | 2007-12-03 16:23:17 +0100
Remove user interaction

........

r361 | naufraghi | 2007-12-03 20:05:25 +0100 (Lun, 03 Dic 2007) | 5 lines

r259@rosen: naufraghi | 2007-12-03 20:01:25 +0100
r223@rosen: naufraghi | 2007-12-03 16:39:48 +0100
Activate the option to run selected tests: runtests.py --run 12 13

........

r362 | naufraghi | 2007-12-03 20:05:32 +0100 (Lun, 03 Dic 2007) | 5 lines

r260@rosen: naufraghi | 2007-12-03 20:01:28 +0100
r224@rosen: naufraghi | 2007-12-03 16:51:02 +0100
Adds a test that fails

........

r363 | naufraghi | 2007-12-03 20:05:41 +0100 (Lun, 03 Dic 2007) | 5 lines

r261@rosen: naufraghi | 2007-12-03 20:01:28 +0100
r225@rosen: naufraghi | 2007-12-03 17:11:07 +0100
Expand imports

........

r364 | naufraghi | 2007-12-03 20:05:48 +0100 (Lun, 03 Dic 2007) | 5 lines

r262@rosen: naufraghi | 2007-12-03 20:01:29 +0100
r226@rosen: naufraghi | 2007-12-03 17:12:21 +0100
Reorder imports

........

r365 | naufraghi | 2007-12-03 20:05:55 +0100 (Lun, 03 Dic 2007) | 5 lines

r263@rosen: naufraghi | 2007-12-03 20:01:30 +0100
r227@rosen: naufraghi | 2007-12-03 17:16:11 +0100
Turns 1-0 to True-False

........

r366 | naufraghi | 2007-12-03 20:06:03 +0100 (Lun, 03 Dic 2007) | 5 lines

r264@rosen: naufraghi | 2007-12-03 20:01:30 +0100
r228@rosen: naufraghi | 2007-12-03 17:32:17 +0100
Path cleanup

........

r367 | naufraghi | 2007-12-03 20:06:10 +0100 (Lun, 03 Dic 2007) | 5 lines

r265@rosen: naufraghi | 2007-12-03 20:01:32 +0100
r229@rosen: naufraghi | 2007-12-03 17:35:21 +0100
Followup: Path cleanup

........

r368 | naufraghi | 2007-12-03 20:06:17 +0100 (Lun, 03 Dic 2007) | 5 lines

r266@rosen: naufraghi | 2007-12-03 20:01:33 +0100
r230@rosen: naufraghi | 2007-12-03 18:42:00 +0100
Add some docs to assemble()

........

r369 | naufraghi | 2007-12-03 20:06:23 +0100 (Lun, 03 Dic 2007) | 5 lines

r267@rosen: naufraghi | 2007-12-03 20:01:35 +0100
r231@rosen: naufraghi | 2007-12-03 18:55:32 +0100
Remove criptic outN.toc numbering, use class names + reformat docs

........

r370 | naufraghi | 2007-12-03 20:06:30 +0100 (Lun, 03 Dic 2007) | 5 lines

r268@rosen: naufraghi | 2007-12-03 20:01:36 +0100
r232@rosen: naufraghi | 2007-12-03 18:56:26 +0100
Restore common prefix 'out'

........

r371 | naufraghi | 2007-12-03 20:06:38 +0100 (Lun, 03 Dic 2007) | 5 lines

r269@rosen: naufraghi | 2007-12-03 20:01:37 +0100
r236@rosen: naufraghi | 2007-12-03 19:16:19 +0100
Cosmetic

........

r372 | naufraghi | 2007-12-03 20:06:45 +0100 (Lun, 03 Dic 2007) | 5 lines

r270@rosen: naufraghi | 2007-12-03 20:01:37 +0100
r237@rosen: naufraghi | 2007-12-03 19:17:17 +0100
Factorize py[c|o] extension choice

........

r373 | naufraghi | 2007-12-04 12:01:51 +0100 (Mar, 04 Dic 2007) | 3 lines

r302@rosen: naufraghi | 2007-12-04 12:00:38 +0100
Restore invcnum

........

r374 | naufraghi | 2007-12-04 12:01:58 +0100 (Mar, 04 Dic 2007) | 3 lines

r303@rosen: naufraghi | 2007-12-04 12:01:41 +0100
Add warning for mod == None

........

r375 | naufraghi | 2007-12-04 12:08:04 +0100 (Mar, 04 Dic 2007) | 2 lines

Add final final "done" message

........

r376 | naufraghi | 2007-12-04 12:09:30 +0100 (Mar, 04 Dic 2007) | 3 lines

Ops, is "config.dat"

........

r377 | naufraghi | 2007-12-04 12:26:20 +0100 (Mar, 04 Dic 2007) | 2 lines

Restored removed "break"

........

r378 | naufraghi | 2007-12-04 16:01:18 +0100 (Mar, 04 Dic 2007) | 2 lines

Remove already logged warning

........

r379 | naufraghi | 2007-12-04 17:46:50 +0100 (Mar, 04 Dic 2007) | 1 line

Minimize test case

........

r380 | naufraghi | 2007-12-04 17:51:07 +0100 (Mar, 04 Dic 2007) | 1 line

Update PathImportDirector? if path changes (for example if modified by _xmlplus hook)

........

r381 | naufraghi | 2007-12-04 18:06:10 +0100 (Mar, 04 Dic 2007) | 1 line

Localize hiddenimport and add hook

........

r382 | naufraghi | 2007-12-04 19:37:45 +0100 (Mar, 04 Dic 2007) | 1 line

Add another elementree test

........

r383 | naufraghi | 2007-12-17 12:58:57 +0100 (Lun, 17 Dic 2007) | 1 line

Fix importHook debug print, add other (commented) print debugs

........

r384 | naufraghi | 2007-12-17 13:00:32 +0100 (Lun, 17 Dic 2007) | 1 line

Support more then one log per spec

........

r385 | naufraghi | 2007-12-17 13:01:10 +0100 (Lun, 17 Dic 2007) | 1 line

Add hidden xml.etree.ElementTree? import

........

r386 | naufraghi | 2007-12-17 13:02:35 +0100 (Lun, 17 Dic 2007) | 1 line

Restore PATH before assert + comments

........

r387 | naufraghi | 2007-12-17 14:42:32 +0100 (Lun, 17 Dic 2007) | 1 line

Print warnings for generic excepts in the code

........

r388 | naufraghi | 2007-12-17 14:56:12 +0100 (Lun, 17 Dic 2007) | 1 line

Use a specific exception for Owners

........

r389 | naufraghi | 2007-12-17 16:44:59 +0100 (Lun, 17 Dic 2007) | 1 line

Remove final comma

........

r390 | naufraghi | 2007-12-18 14:51:06 +0100 (Mar, 18 Dic 2007) | 1 line

Expand debug print

........

r391 | naufraghi | 2007-12-19 18:21:05 +0100 (Mer, 19 Dic 2007) | 1 line

Avoid 'import os' that causes problems in py25

........

r392 | naufraghi | 2007-12-19 18:34:46 +0100 (Mer, 19 Dic 2007) | 1 line

Represent with %r the exception

........

r393 | naufraghi | 2007-12-19 18:37:52 +0100 (Mer, 19 Dic 2007) | 1 line

Add comments and commented prints

........

r401 | naufraghi | 2008-01-11 16:47:02 +0100 (Ven, 11 Gen 2008) | 1 line

Use sys.executable saved at build time (unknown when frozen)

........

r402 | naufraghi | 2008-01-11 17:17:37 +0100 (Ven, 11 Gen 2008) | 1 line

Restore linux compatibility

........

r403 | naufraghi | 2008-01-11 18:37:22 +0100 (Ven, 11 Gen 2008) | 1 line

Add test for sys.getfilesystemencoding()

........

r404 | naufraghi | 2008-01-11 19:42:42 +0100 (Ven, 11 Gen 2008) | 1 line

Accept different error under windows (FIXME: do a real isfile check)

........

r413 | naufraghi | 2008-01-25 19:47:50 +0100 (Ven, 25 Gen 2008) | 1 line

Restore compatibility with python 2.4

........

r424 | naufraghi | 2008-02-18 11:53:12 +0100 (Lun, 18 Feb 2008) | 3 lines

r343@trinity: naufraghi | 2008-02-18 11:53:00 +0100
Merge dal trunk

........

r426 | naufraghi | 2008-02-18 14:49:15 +0100 (Lun, 18 Feb 2008) | 1 line

Catch SyntaxError? too

........

r427 | naufraghi | 2008-02-18 15:02:45 +0100 (Lun, 18 Feb 2008) | 1 line

Revert: DummyZlib? is a zero commpression zlib

........

r429 | naufraghi | 2008-02-23 17:05:35 +0100 (Sab, 23 Feb 2008) | 1 line

Add a (failing) test on module imp

........

r430 | naufraghi | 2008-02-23 18:12:59 +0100 (Sab, 23 Feb 2008) | 1 line

Modified runtest, now all tests are executed (default) but the interactive one(s), thet are executed if -i option is provided

........

r431 | naufraghi | 2008-02-23 18:18:02 +0100 (Sab, 23 Feb 2008) | 1 line

Merge dal branch dl

........

r432 | danielevarrazzo | 2008-02-24 14:38:15 +0100 (Dom, 24 Feb 2008) | 2 lines

Added missing file from the 'dl' branch.

........

r433 | naufraghi | 2008-02-25 13:07:44 +0100 (Lun, 25 Feb 2008) | 1 line

Continue on test failure and report (...) at the end

........

r435 | naufraghi | 2008-02-25 13:28:08 +0100 (Lun, 25 Feb 2008) | 1 line

Stub of a launcher rebuilder

........

r436 | danielevarrazzo | 2008-02-25 13:30:56 +0100 (Lun, 25 Feb 2008) | 2 lines

The Python library is found both in onedir and onefile mode.

........

r437 | naufraghi | 2008-02-25 18:42:16 +0100 (Lun, 25 Feb 2008) | 1 line

Add comments and (commented) debug prints

........

r439 | naufraghi | 2008-02-28 00:16:38 +0100 (Gio, 28 Feb 2008) | 1 line

Cosmetics

........

r440 | danielevarrazzo | 2008-02-28 20:21:15 +0100 (Gio, 28 Feb 2008) | 4 lines

The Python library is added to the package even if bindepend couldn't find it.

This may happen when Python is statically linked, e.g. on debian-based systems.

........

r441 | naufraghi | 2008-03-01 00:46:00 +0100 (Sab, 01 Mar 2008) | 1 line

Remove too restrictive assert

........

r442 | naufraghi | 2008-03-01 00:47:07 +0100 (Sab, 01 Mar 2008) | 1 line

Run Configure.py after make

........

r445 | naufraghi | 2008-04-28 19:42:13 +0200 (Lun, 28 Apr 2008) | 1 line

Merge follow up

........

r448 | naufraghi | 2008-04-30 15:41:51 +0200 (Mer, 30 Apr 2008) | 2 lines

ops, svnmerge was not complete...

........
................

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/crypt/bindepend.py

    r455 r460  
    35 35 import sys  
    36 36 import re  
      37 from glob import glob  
    37 38  
    38 39 seen = {}  
     
    74 75       'MSVCP80.DLL':1,  
    75 76       'MSVCR80.DLL':1,  
      77       # regex excludes  
    76 78       '^/usr/lib':1,  
    77 79       '^/lib':1,  
     
    266 268     #print "I: analyzing", pth  
    267 269     seen[string.upper(nm)] = 1  
      270     for lib, npth in selectImports(pth):  
      271         if seen.get(string.upper(lib),0):  
      272             continue  
      273         lTOC.append((lib, npth, 'BINARY'))  
      274  
      275   return lTOC  
      276  
      277 def selectImports(pth):  
      278     """Return the dependencies of a binary that should be included.  
      279  
      280     Return a list of pairs (name, fullpath)  
      281     """  
      282     rv = []  
    268 283     dlls = getImports(pth)  
    269 284     for lib in dlls:  
    270           #print "I: found", lib  
    271 285         if not iswin and not cygwin:  
      286             # plain win case  
    272 287             npth = lib  
    273 288             dir, lib = os.path.split(lib)  
     
    275 290                 continue  
    276 291         else:  
      292             # all other platforms  
    277 293             npth = getfullnameof(lib, os.path.dirname(pth))  
      294          
      295         # now npth is a candidate lib  
      296         # check again for excludes but with regex FIXME: split the list  
    278 297         if excludesRe.search(npth):  
    279               continue  
    280           if seen.get(string.upper(lib),0):  
    281               continue  
      298             if 'libpython' not in npth and 'Python.framework' not in npth:  
      299                 # skip libs not containing (libpython or Python.framework)  
      300                 #print "I: skipping %20s <- %s" % (npth, pth)  
      301                 continue  
      302             else:  
      303                 #print "I: inserting %20s <- %s" % (npth, pth)  
      304                 pass  
      305                  
    282 306         if npth:  
    283               lTOC.append((lib, npth, 'BINARY'))  
      307             rv.append((lib, npth))  
    283 307         else:  
    284 308             print "E: lib not found:", lib, "dependency of", pth  
    285     return lTOC  
      309  
      310     return rv  
    286 311  
    287 312 def _getImports_ldd(pth):  
     
    354 379     return _bpath  
    355 380  
      381 def fixOsxPaths(moduleName):  
      382     for name, lib in selectImports(moduleName):  
      383         dest = os.path.join("@executable_path", name)  
      384         cmd = "install_name_tool -change %s %s %s" % (lib, dest, moduleName)  
      385         os.system(cmd)  
      386  
      387 def findLibrary(name):  
      388     """Look for a library in the system.  
      389  
      390     Emulate the algorithm used by dlopen.  
      391  
      392     `name`must include the prefix, e.g. ``libpython2.4.so``  
      393     """  
      394     assert sys.platform == 'linux2', "Current implementation for Linux only"  
      395  
      396     lib = None  
      397  
      398     # Look in the LD_LIBRARY_PATH  
      399     lp = os.environ.get('LD_LIBRARY_PATH')  
      400     if lp:  
      401         for path in string.split(lp, os.pathsep):  
      402             libs = glob(os.path.join(path, name + '*'))  
      403             if libs:  
      404                 lib = libs[0]  
      405                 break  
      406  
      407     # Look in /etc/ld.so.cache  
      408     if lib is None:  
      409         expr = r'/[^\(\)\s]*%s\.[^\(\)\s]*' % re.escape(name)  
      410         m = re.search(expr, os.popen('/sbin/ldconfig -p 2>/dev/null').read())  
      411         if m:  
      412             lib = m.group(0)  
      413  
      414     # Look in the known safe paths  
      415     if lib is None:  
      416         for path in ['/lib', '/usr/lib']:  
      417             libs = glob(os.path.join(path, name + '*'))  
      418             if libs:  
      419                 lib = libs[0]  
      420                 break  
      421  
      422     # give up :(  
      423     if lib is None:  
      424         return None  
      425  
      426     # Resolve the file name into the soname  
      427     dir, file = os.path.split(lib)  
      428     return os.path.join(dir, getSoname(lib))  
      429  
      430 def getSoname(filename):  
      431     """Return the soname of a library."""  
      432     cmd = "objdump -p -j .dynamic 2>/dev/null " + filename  
      433     m = re.search(r'\s+SONAME\s+([^\s]+)', os.popen(cmd).read())  
      434     if m: return m.group(1)  
      435  
    356 436 if __name__ == "__main__":  
    357     if len(sys.argv) < 2:  
    358       print "Usage: python %s BINARYFILE" % sys.argv[0]  
    359       sys.exit(0)  
    360     print getImports(sys.argv[1])  
      437     if len(sys.argv) < 2:  
      438         print "Usage: python %s BINARYFILE" % sys.argv[0]  
      439         sys.exit(0)  
      440     print getImports(sys.argv[1])  
      441  
  • branches/crypt/buildtests/test10.py

    r316 r460  
    1 1 # Verify packagin of PIL.Image. Specifically, the hidden import of FixTk  
    2 2 # importing tkinter is causing some problems.  
    3   from Image import fromstring  
      3 try:  
      4     from Image import fromstring  
      5 except ImportError:  
      6     fromstring = "PIL missing!! Install PIL before running this test!"  
    4 7 print fromstring  
  • branches/crypt/buildtests/test11.py

    r316 r460  
    1 1 # Verify packagin of PIL.Image. Specifically, the hidden import of FixTk  
    2 2 # importing tkinter is causing some problems.  
    3   from PIL.Image import fromstring  
      3 try:  
      4     from PIL.Image import fromstring  
      5 except ImportError:  
      6     fromstring = "PIL missing!! Install PIL before running this test!"  
    4 7 print fromstring  
  • branches/crypt/buildtests/runtests.py

    r457 r460  
    24 24 import os, sys, glob, string  
    25 25 import shutil  
      26  
    26 27 try:  
    27 28     here=os.path.dirname(__file__)  
     
    54 55             print e  
    55 56  
    56   def runtests(sources=None):  
      57 def runtests(alltests, filters=None):  
    56 57     info = "Executing PyInstaller tests in: %s" % os.getcwd()  
    57 58     print "*"*len(info)  
    58 59     print info  
    59 60     print "*"*len(info)  
    60       alltests = glob.glob('test*[0-9].py')  
    61       if not sources:  
      61     build_python = open("python_exe.build", "w")                                       
      62     build_python.write(sys.executable)                                                 
      63     build_python.close()  
      64     if not filters:  
    62 65         tests = alltests  
    63 66     else:  
    64 67         tests = []  
    65           for part in sources:  
      68         for part in filters:  
    65 68             tests += [t for t in alltests if part in t and t not in tests]  
    66 69     tests.sort(key=lambda x: (len(x), x)) # test1 < test10  
    67 70     path = os.environ["PATH"]  
      71     counter = dict(passed=[],failed=[])  
    68 72     for src in tests:  
    69 73         print  
     
    81 85         res = os.system('dist%s%s%s.exe' % (test, os.sep, test))  
    82 86         os.environ["PATH"] = path  
    83           assert res == 0, "%s Test error!" % src  
    84           print "################## FINISHING TEST %s ################################" % src  
      87         if res == 0:  
      88             counter["passed"].append(src)  
      89             print "################## FINISHING TEST %s ################################" % src  
      90         else:  
      91             counter["failed"].append(src)  
      92             print "#################### TEST %s FAILED #################################" % src  
      93     print counter  
    85 94  
    86 95 if __name__ == '__main__':  
    87       if len(sys.argv) == 1:  
    88           clean()  
    89           runtests()  
    90       if '--clean' in sys.argv:  
    91           clean()  
    92       if '--run' in sys.argv:  
    93           runtests(sys.argv[2:])  
      96     normal_tests = glob.glob('test*[0-9].py')  
      97     interactive_tests = glob.glob('test*[0-9]i.py')  
      98     args = sys.argv[1:]  
      99      
      100     if "-i" in args:  
      101         print "Running interactive tests"  
      102         tests = interactive_tests  
      103     else:  
      104         print "Running normal tests (-i for interactive tests)"  
      105         tests = normal_tests  
      106  
      107     clean()  
      108     runtests(tests)  
      109  
  • branches/crypt/Build.py

    r457 r460  
    87 87     if not os.path.exists(BUILDPATH):  
    88 88         os.mkdir(BUILDPATH)  
    89       exec open(spec, 'r').read()+'\n'  
      89     execfile(spec)  
    89 89  
    90 90 def mtime(fnm):  
     
    95 95         return 0  
    96 96  
      97 def absnormpath(apath):  
      98     return os.path.abspath(os.path.normpath(apath))  
      99  
    97 100 class Target:  
    98 101     invcnum = 0  
    99 102     def __init__(self):  
    100 103         self.invcnum = Target.invcnum  
    101           Target.invcnum = Target.invcnum + 1  
    102           self.out = os.path.join(BUILDPATH, 'out%d.toc' % self.invcnum)  
      104         Target.invcnum += 1  
      105         self.out = os.path.join(BUILDPATH, 'out%s%d.toc' % (self.__class__.__name__,  
      106                                                             self.invcnum))  
    103 107         self.dependencies = TOC()  
    104 108     def __postinit__(self):  
     
    117 121         if pathex:  
    118 122             for path in pathex:  
    119                   self.pathex.append(os.path.abspath(os.path.normpath(path)))  
      123                 self.pathex.append(absnormpath(path))  
    119 123         self.hookspath = hookspath  
    120 124         self.excludes = excludes  
     
    128 132         if last_build == 0:  
    129 133             print "building %s because %s non existent" % (self.__class__.__name__, outnm)  
    130               return 1  
      134             return True  
    130 134         for fnm in self.inputs:  
    131 135             if mtime(fnm) > last_build:  
    132 136                 print "building because %s changed" % fnm  
    133                   return 1  
      137                 return True  
    133 137         try:  
    134 138             inputs, pathex, hookspath, excludes, scripts, pure, binaries = eval(open(self.out, 'r').read())  
    135 139         except:  
    136 140             print "building because %s disappeared" % outnm  
    137               return 1  
      141             return True  
    137 141         if inputs != self.inputs:  
    138 142             print "building %s because inputs changed" % outnm  
    139               return 1  
      143             return True  
    139 143         if pathex != self.pathex:  
    140 144             print "building %s because pathex changed" % outnm  
    141               return 1  
      145             return True  
    141 145         if hookspath != self.hookspath:  
    142 146             print "building %s because hookspath changed" % outnm  
    143               return 1  
      147             return True  
    143 147         if excludes != self.excludes:  
    144 148             print "building %s because excludes changed" % outnm  
    145               return 1  
      149             return True  
    145 149         for (nm, fnm, typ) in scripts:  
    146 150             if mtime(fnm) > last_build:  
    147 151                 print "building because %s changed" % fnm  
    148                   return 1  
      152                 return True  
    148 152         for (nm, fnm, typ) in pure:  
    149 153             if mtime(fnm) > last_build:  
    150 154                 print "building because %s changed" % fnm  
    151                   return 1  
      155                 return True  
    151 155             elif mtime(fnm[:-1]) > last_build:  
    152 156                 print "building because %s changed" % fnm[:-1]  
    153                   return 1  
      157                 return True  
    153 157         for (nm, fnm, typ) in binaries:  
    154 158             if mtime(fnm) > last_build:  
    155 159                 print "building because %s changed" % fnm  
    156                   return 1  
      160                 return True  
    156 160         self.scripts = TOC(scripts)  
    157 161         self.pure = TOC(pure)  
    158 162         self.binaries = TOC(binaries)  
    159           return 0  
      163         return False  
    159 163     def assemble(self):  
    160 164         print "running Analysis", os.path.basename(self.out)  
    161 165         paths = self.pathex  
    162 166         for i in range(len(paths)):  
    163               paths[i] = os.path.abspath(os.path.normpath(paths[i]))  
    164           dirs = {}  
    165           pynms = []  
      167             # FIXME: isn't self.pathex already norm-abs-pathed?  
      168             paths[i] = absnormpath(paths[i])  
      169         ###################################################  
      170         # Scan inputs and prepare:  
      171         dirs = {}  # input directories  
      172         pynms = [] # python filenames with no extension  
    166 173         for script in self.inputs:  
    167 174             if not os.path.exists(script):  
     
    183 190             if not d:  
    184 191                 d = os.getcwd()  
    185               d = os.path.abspath(os.path.normpath(d))  
      192             d = absnormpath(d)  
    185 192             pynm, ext = os.path.splitext(base)  
    186 193             dirs[d] = 1  
    187 194             pynms.append(pynm)  
      195         ###################################################  
      196         # Initialize analyzer and analyze scripts  
    188 197         analyzer = mf.ImportTracker(dirs.keys()+paths, self.hookspath, self.excludes)  
    189 198         #print analyzer.path  
    190           scripts = []  
      199         scripts = [] # will contain scripts to bundle  
    190 199         for i in range(len(self.inputs)):  
    191 200             script = self.inputs[i]  
     
    195 204             analyzer.analyze_script(script)  
    196 205             scripts.append((pynms[i], script, 'PYSOURCE'))  
    197           pure = []  
    198           binaries = []  
    199           rthooks = []  
      206         ###################################################  
      207         # Fills pure, binaries and rthookcs lists to TOC  
      208         pure = []     # pure python modules  
      209         binaries = [] # binaries to bundle  
      210         rthooks = []  # rthooks if needed  
    200 211         for modnm, mod in analyzer.modules.items():  
      212             # FIXME: why can we have a mod == None here?  
    201 213             if mod is not None:  
    202 214                 hooks = findRTHook(modnm)  #XXX  
     
    214 226                         pure.append((modnm, fnm, 'PYMODULE'))  
    215 227         binaries.extend(bindepend.Dependencies(binaries))  
      228         self.fixMissingPythonLib(binaries)  
    216 229         scripts[1:1] = rthooks  
    217 230         self.scripts = TOC(scripts)  
    218 231         self.pure = TOC(pure)  
    219 232         self.binaries = TOC(binaries)  
    220           try:  
      233         try: # read .toc  
    220 233             oldstuff = eval(open(self.out, 'r').read())  
    221 234         except:  
     
    237 250         return 0  
    238 251  
      252     def fixMissingPythonLib(self, binaries):  
      253         """Add the Python library if missing from the binaries.  
      254  
      255         Some linux distributions (e.g. debian-based) statically build the  
      256         Python executable to the libpython, so bindepend doesn't include  
      257         it in its output.  
      258         """  
      259         if sys.platform != 'linux2': return  
      260  
      261         name = 'libpython%d.%d.so' % sys.version_info[:2]  
      262         for (nm, fnm, typ) in binaries:  
      263             if typ == 'BINARY' and name in fnm:  
      264                 # lib found  
      265                 return  
      266  
      267         lib = bindepend.findLibrary(name)  
      268         if lib is None:  
      269             raise IOError("Python library not found!")  
      270  
      271         binaries.append((os.path.split(lib)[1], lib, 'BINARY'))  
      272  
      273  
    239 274 def findRTHook(modnm):  
    240 275     hooklist = rthooks.get(modnm)  
     
    319 354     return digest  
    320 355  
    321   def checkCache(fnm, strip, upx):  
    322       if not strip and not upx:  
      356 def checkCache(fnm, strip, upx, fix_paths=1):  
      357     # On darwin a cache is required anyway to keep the libaries  
      358     # with relative install names  
      359     if not strip and not upx and sys.platform != 'darwin':  
    323 360         return fnm  
    324 361     if strip:  
     
    345 382     digest = cacheDigest(fnm)  
    346 383     cachedfile = os.path.join(cachedir, basenm)  
      384     cmd = None  
    347 385     if cache_index.has_key(basenm):  
    348 386         if digest != cache_index[basenm]:  
     
    352 390     if upx:  
    353 391         if strip:  
    354               fnm = checkCache(fnm, 1, 0)  
      392             fnm = checkCache(fnm, 1, 0, fix_paths=0)  
    354 392         cmd = "upx --best -q \"%s\"" % cachedfile  
    355 393     else:  
    356           cmd = "strip \"%s\"" % cachedfile  
      394         if strip:  
      395             cmd = "strip \"%s\"" % cachedfile  
    357 396     shutil.copy2(fnm, cachedfile)  
    358 397     os.chmod(cachedfile, 0755)  
    359       os.system(cmd)  
      398     if cmd: os.system(cmd)  
      399  
      400     if sys.platform == 'darwin' and fix_paths:  
      401         bindepend.fixOsxPaths(cachedfile)  
    360 402  
    361 403     # update cache index  
  • branches/crypt/mf.py

    r459 r460  
    38 38         return True  
    39 39  
      40 def pyco():  
      41     """  
      42     Returns correct extension ending: 'c' or 'o'  
      43     """  
      44     if __debug__:  
      45         return 'c'  
      46     else:  
      47         return 'o'  
    40 48  
    41 49 class Owner:  
     
    65 73                 try:  
    66 74                     st = os.stat(attempt)  
    67                   except:  
      75                 except Exception, e:  
      76                     #print "DirOwner", e  
    68 77                     pass  
    69 78                 else:  
     
    72 81                         continue  
    73 82                     if typ == imp.C_EXTENSION:  
      83                         #print "DirOwner.getmod -> ExtensionModule(%s, %s)" % (nm, attempt)  
    74 84                         return ExtensionModule(nm, attempt)  
    75 85                     elif typ == imp.PY_SOURCE:  
     
    80 90                 break  
    81 91         if py is None and pyc is None:  
      92             #print "DirOwner.getmod -> (py == pyc == None)"  
    82 93             return None  
    83 94         while 1:  
      95             # If we have no pyc or py is newer  
    84 96             if pyc is None or py and pyc[1][8] < py[1][8]:  
    85 97                 try:  
    86 98                     stuff = open(py[0], 'r').read()+'\n'  
    87 99                     co = compile(string.replace(stuff, "\r\n", "\n"), py[0], 'exec')  
    88 &nb