This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author John.Malmberg
Recipients John.Malmberg
Date 2014-08-16.21:29:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408224552.38.0.698985209475.issue22212@psf.upfronthosting.co.za>
In-reply-to
Content
If the zlib.so fails to build while building python, subsequent runs of setup.py fail, which prevents a trying again to build zlib.so after the issue is fixed unless all the .so modules built are deleted.

   File "/PRJ_ROOT/CPYTHON/Lib/zipfile.py", line 20, in <module>
     crc32 = zlib.crc32
AttributeError: module 'zlib' has no attribute 'crc32'
make: *** [sharedmods] Error 1


zipfile.py is trying to test for a missing zlib.so by checking if the import fails.

The problem is that while the zlib module did not get built, the import of it succeeds because the directory is now in the module path at this
point in the build.

Using -v on Python shows the import succeeding.

Python 3.5.0a0 (default, Aug 13 2014, 19:13:13) [C] on openvms0
Type "help", "copyright", "credits" or "license" for more information.
 >>> import zlib
# possible namespace for /PRJ_ROOT/CPYTHON/Modules/zlib
import 'zlib' # None.

In order to get setup.py to work in this case, the following patch is
needed for zipfile.py

--- /src_root/cpython/Lib/zipfile.py    Mon Jun 16 18:00:20 2014
+++ /vms_root/cpython/Lib/zipfile.py    Thu Aug 14 20:39:47 2014
@@ -18,7 +18,7 @@
  try:
      import zlib # We may need its compression method
      crc32 = zlib.crc32
-except ImportError:
+except (ImportError, AttributeError):
      zlib = None
      crc32 = binascii.crc32

This is not a complete solution for zlib.so module not building.  The run_tests.py also fails when zlib.so is not present.

Setup.py reports that zlib.so is an optional module, so not being build should not cause the setup.py to fail.
History
Date User Action Args
2014-08-16 21:29:12John.Malmbergsetrecipients: + John.Malmberg
2014-08-16 21:29:12John.Malmbergsetmessageid: <1408224552.38.0.698985209475.issue22212@psf.upfronthosting.co.za>
2014-08-16 21:29:12John.Malmberglinkissue22212 messages
2014-08-16 21:29:11John.Malmbergcreate