From: On Behalf Of Martin Zibricky
> Sent: May 9, 2011 4:53 AM
> MacDonald, Stuart píše v Ne 08. 05. 2011 v 23:32 -0400:
> > - Add hooks for processing each file as it is found by the
> > ImportTracker, although I think this is an mf.py item
>
> by 'hooks' you mean import hooks?
No, I meant regular old hooks; a general example is pre- and
post-install hooks in installation scripts.
> Is there a ticket for that or are you referencing any bug or discussion?
No and no.
> Could you please provide more details?
Okay. I do this (manually, in my own script):
============================================================
ver_table = StringTable('040904b0')
# The replace makes versionInfo not choke on embedded single quotes
later on
ver_table.kids.append(StringStruct('Python',
sys.version_info.__str__().replace("'", '"')))
ver_table.kids.append(StringStruct('PyInstaller', pyinstaller_version))
svn = pysvn.Client()
finder = mf.ImportTracker()
finder.analyze_script(script_name)
keys = finder.modules.keys()
keys.sort()
for key in keys:
m = finder.modules[key]
if m and m.__file__:
file = m.__file__
# mf only keeps the compiled source name; this
unmangling is based on the operation of mf.pyco()
if file.endswith(('.pyc', '.pyo')):
file = file[:-1]
try:
entry = svn.info(file)
except:
entry = None
if not entry is None:
basefile = os.path.basename(file)
ver_table.kids.append(StringStruct(basefile,
"%d, %d" % (entry.revision.number, entry.commit_revision.number)))
if basefile == script_name:
script_revision = entry.revision.number
script_commit =
entry.commit_revision.number
[later in the script...]
# invoke pyinstaller
os.system('python ' + os.path.join(pyinstaller_path, 'Configure.py'))
os.system('python ' + os.path.join(pyinstaller_path, 'Makespec.py') + '
--version=' + version_out + ' --out=' + script_nym + ' ' + script_name)
os.system('python ' + os.path.join(pyinstaller_path, 'Build.py') + ' -y
' + os.path.join(script_nym, script_nym + '.spec'))
============================================================
So I've manually invoked ImportTracker, retrieved the svn revisions of
files under source control, output that to a versionInfo file, and
then invoked PyInstaller. So import tracking is run twice.
What I wanted to do is define a function for outputting svn revisions,
pass that function to ImportTracker and have ImportTracker run my
function on every file it finds, the same way I do above. The
difference is this method is one pass of import tracking, not two.
...Stu
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.