mirror of
https://github.com/kennethreitz-archive/pyinstaller.git
synced 2026-06-05 23:50:17 +00:00
82ab43bb1e
https://svn.pyinstaller.python-hosting.com/branches/python2.5 ........ 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... ........ git-svn-id: http://svn.pyinstaller.org/trunk@449 8dd32b29-ccff-0310-8a9a-9233e24343b1
243 lines
8.0 KiB
Python
Executable File
243 lines
8.0 KiB
Python
Executable File
#! /usr/bin/env python
|
|
# Configure PyInstaller for the current Python installation.
|
|
# Copyright (C) 2005, Giovanni Bajo
|
|
# Based on previous work under copyright (c) 2002 McMillan Enterprises, Inc.
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
import os, sys, string, shutil
|
|
HOME = os.path.dirname(sys.argv[0])
|
|
iswin = sys.platform[:3] == 'win'
|
|
is24 = hasattr(sys, "version_info") and sys.version_info[:2] >= (2,4)
|
|
cygwin = sys.platform == 'cygwin'
|
|
configfile = os.path.join(HOME, 'config.dat')
|
|
try:
|
|
config = eval(open(configfile, 'r').read())
|
|
except IOError, SyntaxError:
|
|
# IOerror: file not present
|
|
# SyntaxError: invalid file (platform change?)
|
|
config = {'useELFEXE':1} # if not set by Make.py we can assume Windows
|
|
|
|
|
|
# Save Python version, to detect and avoid conflicts
|
|
config["pythonVersion"] = sys.version
|
|
|
|
import mf, bindepend
|
|
|
|
# EXE_dependencies
|
|
print "I: computing EXE_dependencies"
|
|
python = sys.executable
|
|
if not iswin:
|
|
while os.path.islink(python):
|
|
python = os.path.join(os.path.split(python)[0], os.readlink(python))
|
|
|
|
toc = bindepend.Dependencies([('', python, '')])
|
|
if iswin and sys.version[:3] == '1.5':
|
|
import exceptions
|
|
toc.append((os.path.basename(exceptions.__file__), exceptions.__file__, 'BINARY'))
|
|
config['EXE_dependencies'] = toc[1:]
|
|
|
|
_useTK = """\
|
|
# Generated by Configure.py
|
|
# This file is public domain
|
|
import os, sys
|
|
try:
|
|
basedir = os.environ['_MEIPASS2']
|
|
except KeyError:
|
|
basedir = sys.path[0]
|
|
tcldir = os.path.join(basedir, '_MEI', 'tcl%s')
|
|
tkdir = os.path.join(basedir, '_MEI', 'tk%s')
|
|
os.environ["TCL_LIBRARY"] = tcldir
|
|
os.environ["TK_LIBRARY"] = tkdir
|
|
os.putenv("TCL_LIBRARY", tcldir)
|
|
os.putenv("TK_LIBRARY", tkdir)
|
|
"""
|
|
|
|
# TCL_root, TK_root and support/useTK.py
|
|
print "I: Finding TCL/TK..."
|
|
if not iswin:
|
|
saveexcludes = bindepend.excludes
|
|
bindepend.excludes = {}
|
|
import re
|
|
pattern = [r'libtcl(\d\.\d)?\.so', r'(?i)tcl(\d\d)\.dll'][iswin]
|
|
a = mf.ImportTracker()
|
|
a.analyze_r('Tkinter')
|
|
binaries = []
|
|
for modnm, mod in a.modules.items():
|
|
if isinstance(mod, mf.ExtensionModule):
|
|
binaries.append((mod.__name__, mod.__file__, 'EXTENSION'))
|
|
binaries.extend(bindepend.Dependencies(binaries))
|
|
binaries.extend(bindepend.Dependencies([('', sys.executable, '')]))
|
|
for nm, fnm, typ in binaries:
|
|
mo = re.match(pattern, nm)
|
|
if mo:
|
|
ver = mo.group(1)
|
|
tclbindir = os.path.dirname(fnm)
|
|
if iswin:
|
|
ver = ver[0] + '.' + ver[1:]
|
|
elif ver is None:
|
|
# we found "libtcl.so.0" so we need to get the version from the lib directory
|
|
for name in os.listdir(tclbindir):
|
|
mo = re.match(r'tcl(\d.\d)', name)
|
|
if mo:
|
|
ver = mo.group(1)
|
|
print "I: found TCL/TK version %s" % ver
|
|
open(os.path.join(HOME, 'support/useTK.py'), 'w').write(_useTK % (ver, ver))
|
|
tclnm = 'tcl%s' % ver
|
|
tknm = 'tk%s' % ver
|
|
# Linux: /usr/lib with the .tcl files in /usr/lib/tcl8.3 and /usr/lib/tk8.3
|
|
# Windows: Python21/DLLs with the .tcl files in Python21/tcl/tcl8.3 and Python21/tcl/tk8.3
|
|
# or D:/Programs/Tcl/bin with the .tcl files in D:/Programs/Tcl/lib/tcl8.0 and D:/Programs/Tcl/lib/tk8.0
|
|
if iswin:
|
|
for attempt in ['../tcl', '../lib']:
|
|
if os.path.exists(os.path.join(tclbindir, attempt, tclnm)):
|
|
config['TCL_root'] = os.path.join(tclbindir, attempt, tclnm)
|
|
config['TK_root'] = os.path.join(tclbindir, attempt, tknm)
|
|
break
|
|
else:
|
|
config['TCL_root'] = os.path.join(tclbindir, tclnm)
|
|
config['TK_root'] = os.path.join(tclbindir, tknm)
|
|
break
|
|
else:
|
|
print "I: could not find TCL/TK"
|
|
if not iswin:
|
|
bindepend.excludes = saveexcludes
|
|
|
|
#useZLIB
|
|
print "I: testing for Zlib..."
|
|
try:
|
|
import zlib
|
|
except ImportError:
|
|
config['useZLIB'] = 0
|
|
print 'I: ... Zlib unavailable'
|
|
else:
|
|
config['useZLIB'] = 1
|
|
print 'I: ... Zlib available'
|
|
|
|
#hasRsrcUpdate
|
|
if iswin:
|
|
# only available on windows
|
|
print "I: Testing for ability to set icons, version resources..."
|
|
try:
|
|
import win32api, icon, versionInfo
|
|
except ImportError, detail:
|
|
config['hasRsrcUpdate'] = 0
|
|
print 'I: ... resource update unavailable -', detail
|
|
else:
|
|
test_exe = os.path.join(HOME, r'support\loader\run_7rw.exe')
|
|
if not os.path.exists( test_exe ):
|
|
config['hasRsrcUpdate'] = 0
|
|
print 'E: ... resource update unavailable - %s not found' % test_exe
|
|
else:
|
|
# The test_exe may be read-only
|
|
# make a writable copy and test using that
|
|
rw_test_exe = os.path.join( os.environ['TEMP'], 'me_test_exe.tmp' )
|
|
shutil.copyfile( test_exe, rw_test_exe )
|
|
try:
|
|
hexe = win32api.BeginUpdateResource(rw_test_exe,0)
|
|
except:
|
|
config['hasRsrcUpdate'] = 0
|
|
print 'I: ... resource update unavailable - win32api.BeginUpdateResource failed'
|
|
else:
|
|
win32api.EndUpdateResource(hexe, 1)
|
|
config['hasRsrcUpdate'] = 1
|
|
print 'I: ... resource update available'
|
|
os.remove(rw_test_exe)
|
|
else:
|
|
config['hasRsrcUpdate'] = 0
|
|
|
|
_useUnicode = """\
|
|
# Generated by Configure.py
|
|
# This file is public domain
|
|
import %s
|
|
"""
|
|
|
|
_useUnicodeFN = os.path.join(HOME, 'support', 'useUnicode.py')
|
|
|
|
#hasUnicode
|
|
print 'I: Testing for Unicode support...'
|
|
try:
|
|
import codecs
|
|
config['hasUnicode'] = 1
|
|
try:
|
|
import encodings
|
|
except ImportError:
|
|
module = "codecs"
|
|
else:
|
|
module = "encodings"
|
|
open(_useUnicodeFN, 'w').write(_useUnicode % module)
|
|
print 'I: ... Unicode available'
|
|
except ImportError:
|
|
try:
|
|
os.remove(_useUnicodeFN)
|
|
except OSError:
|
|
pass
|
|
config['hasUnicode'] = 0
|
|
print 'I: ... Unicode NOT available'
|
|
|
|
#hasUPX
|
|
print 'I: testing for UPX...'
|
|
hasUPX = 0
|
|
try:
|
|
vers = os.popen("upx -V").readlines()
|
|
if not vers:
|
|
hasUPX = 0
|
|
else:
|
|
v = string.split(vers[0])[1]
|
|
hasUPX = tuple(map(int, string.split(v, ".")))
|
|
if iswin and is24 and hasUPX < (1,92):
|
|
print 'E: UPX is too old! Python 2.4 under Windows requires UPX 1.92+'
|
|
hasUPX = 0
|
|
print 'I: ...UPX %s' % (('unavailable','available')[hasUPX != 0])
|
|
except Exception, e:
|
|
print 'I: ...exception result in testing for UPX'
|
|
print e, e.args
|
|
config['hasUPX'] = hasUPX
|
|
|
|
# now write out config, so Build can load
|
|
outf = open(configfile, 'w')
|
|
import pprint
|
|
pprint.pprint(config, outf)
|
|
outf.close()
|
|
|
|
import Build
|
|
|
|
# PYZ_dependencies
|
|
print "I: computing PYZ dependencies..."
|
|
a = mf.ImportTracker([os.path.join(HOME, 'support')])
|
|
a.analyze_r('archive')
|
|
mod = a.modules['archive']
|
|
toc = Build.TOC([(mod.__name__, mod.__file__, 'PYMODULE')])
|
|
for i in range(len(toc)):
|
|
nm, fnm, typ = toc[i]
|
|
mod = a.modules[nm]
|
|
tmp = []
|
|
for importednm, isdelayed, isconditional in mod.imports:
|
|
if not isconditional:
|
|
realnms = a.analyze_one(importednm, nm)
|
|
for realnm in realnms:
|
|
imported = a.modules[realnm]
|
|
if not isinstance(imported, mf.BuiltinModule):
|
|
tmp.append((imported.__name__, imported.__file__, imported.typ))
|
|
toc.extend(tmp)
|
|
toc.reverse()
|
|
config['PYZ_dependencies'] = toc.data
|
|
|
|
outf = open(configfile, 'w')
|
|
import pprint
|
|
pprint.pprint(config, outf)
|
|
outf.close()
|
|
print "I: config.dat generation done!"
|