Hello,

starting with Python 2.3, when the builtin function "time.strptime" is
called, the C code imports the external module _strptime.py in the standard
library. This is a hidden import that PyInstaller was not aware of, so code
using strptime() was broken when packaged with PyInstaller.

Committed as r254, thanks to Lorenzo Mancini for the bugreport. I'm positive
in having this into 1.1.
-- 
Giovanni Bajo
Index: buildtests/test9.py
===================================================================
--- buildtests/test9.py (revision 0)
+++ buildtests/test9.py (revision 254)
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+import time
+print time.strptime(time.ctime())

Property changes on: buildtests\test9.py
___________________________________________________________________
Name: svn:eol-style
   + native

Index: buildtests/test9.spec
===================================================================
--- buildtests/test9.spec       (revision 0)
+++ buildtests/test9.spec       (revision 254)
@@ -0,0 +1,16 @@
+a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), 
os.path.join(HOMEPATH,'support\\useUnicode.py'), 'test9.py'],
+             pathex=['D:\\Work\\pyinstaller\\buildtests'])
+pyz = PYZ(a.pure)
+exe = EXE(pyz,
+          a.scripts,
+          exclude_binaries=1,
+          name='buildtest9/test9.exe',
+          debug=False,
+          strip=False,
+          upx=False,
+          console=True )
+coll = COLLECT( exe,
+               a.binaries,
+               strip=False,
+               upx=False,
+               name='disttest9')
Index: hooks/hook-time.py
===================================================================
--- hooks/hook-time.py  (revision 0)
+++ hooks/hook-time.py  (revision 254)
@@ -0,0 +1,23 @@
+# Copyright (C) 2006, Giovanni Bajo
+# Based on previous work under copyright (c) 2001, 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 sys
+
+# Since Python 2.3, builtin module "time" imports Python module _strptime
+# to implement "time.strptime".
+if hasattr(sys, "version_info") and sys.version_info >= (2,3):
+    hiddenimports = ['_strptime']

Property changes on: hooks\hook-time.py
___________________________________________________________________
Name: svn:eol-style
   + native

Index: doc/CHANGES.txt
===================================================================
--- doc/CHANGES.txt     (revision 253)
+++ doc/CHANGES.txt     (revision 254)
@@ -13,6 +13,7 @@
  + Mimic Python 2.4 behaviour with broken imports: sys.modules is cleaned up
    afterwise. This allows to package SQLObject applications under Windows
    with Python 2.4 and above.
+ + Fix packaging of code using "time.strptime" under Python 2.3+.
  + Add import hook for GTK.
  + Add import hook for PyOpenGL.
  + Add import hook for dnspython (tested with 1.3.4)
_______________________________________________
PyInstaller mailing list
[email protected]
http://lists.hpcf.upr.edu/mailman/listinfo/pyinstaller

Reply via email to