20632171 Mailman should publish its .pyc files s11-update
authorJohn Beck <John.Beck@Oracle.COM>
Wed, 04 Mar 2015 15:13:21 -0800
branchs11-update
changeset 3922 f4e70ad144ea
parent 3921 11f3a18e5d09
child 3923 d19fbc6076b9
20632171 Mailman should publish its .pyc files
components/mailman/Makefile
components/mailman/mailman.p5m
make-rules/shared-macros.mk
transforms/autopyc
--- a/components/mailman/Makefile	Tue Feb 17 16:34:10 2015 -0800
+++ b/components/mailman/Makefile	Wed Mar 04 15:13:21 2015 -0800
@@ -53,7 +53,16 @@
 
 ASLR_MODE = $(ASLR_ENABLE)
 
-# common targets
+# Copy generated file to proto area.  Then py-compile several files that are
+# used as modules in a devious way.
+COMPONENT_POST_INSTALL_ACTION=	\
+	($(CP) $(BUILD_DIR_64)/Mailman/Defaults.py \
+		$(PROTOUSRLIBDIR)/mailman/Mailman/ ; \
+	 $(PYTHON.2.7) -m py_compile $(PROTOUSRLIBDIR)/mailman/*/paths.py \
+		$(PROTOUSRLIBDIR)/mailman/Mailman/Defaults.py)
+
+configure:	$(CONFIGURE_64)
+
 build:		$(BUILD_64)
 
 install:	$(INSTALL_64)
--- a/components/mailman/mailman.p5m	Tue Feb 17 16:34:10 2015 -0800
+++ b/components/mailman/mailman.p5m	Wed Mar 04 15:13:21 2015 -0800
@@ -25,6 +25,19 @@
 
 <transform file path=usr/lib/mailman/tests/.* -> \
     default facet.optional.test true>
+# Exception to the exception below: paths.py instances.  These are modules
+# despite not looking like them.
+<transform file path=usr/lib/mailman/.*/paths\.py$ -> default \
+    pkg.tmp.pyversion 2.X>
+# Exception to the "Generate ..." rule below: certain sub-directories.
+<transform file path=usr/lib/mailman/(bin|cron|scripts|tests)/.*\.py$ -> \
+    default pkg.tmp.pyversion none>
+# Generate Python 2.x style .pyc files for all .py files.  Note that here
+# (and above) we set pkg.tmp.pyversion to "2.x" or "none" instead of the usual
+# setting of pkg.tmp.autopyc to "true" or "false" because the autopyc transform
+# file only deals with stuff under usr/lib/python[23].*; 20632788 has been
+# filed to clean this up.
+<transform file path=usr/lib/mailman/.*\.py$ -> default pkg.tmp.pyversion 2.X>
 <transform file \
     path=usr/lib/mailman/(messages|templates)/([^/]+)(\..+){0,1}(/.+){0,1}/.* \
     -> default facet.locale.%<\2> true>
@@ -59,6 +72,8 @@
 file mailman.conf path=etc/apache2/2.4/samples-conf.d/mailman.conf
 file usr/lib/mailman/Mailman/mm_cfg.py path=etc/mailman/mm_cfg.py \
     owner=mailman group=mailman mode=0644 overlay=allow preserve=true
+file usr/lib/mailman/Mailman/mm_cfg.pyc path=etc/mailman/mm_cfg.pyc \
+    owner=mailman group=mailman mode=0644 overlay=allow preserve=true
 file files/mailman.auth_attr path=etc/security/auth_attr.d/mailman group=sys
 file files/mailman.exec_attr path=etc/security/exec_attr.d/mailman group=sys
 file files/mailman.prof_attr path=etc/security/prof_attr.d/mailman group=sys
@@ -123,7 +138,7 @@
 file path=usr/lib/mailman/Mailman/Commands/cmd_subscribe.py
 file path=usr/lib/mailman/Mailman/Commands/cmd_unsubscribe.py
 file path=usr/lib/mailman/Mailman/Commands/cmd_who.py
-file $(MACH64)/Mailman/Defaults.py path=usr/lib/mailman/Mailman/Defaults.py
+file path=usr/lib/mailman/Mailman/Defaults.py
 file path=usr/lib/mailman/Mailman/Deliverer.py
 file path=usr/lib/mailman/Mailman/Digester.py
 file path=usr/lib/mailman/Mailman/Errors.py
@@ -216,6 +231,8 @@
 link path=usr/lib/mailman/Mailman/mm_cfg.py \
     target=../../../../etc/mailman/mm_cfg.py
 file path=usr/lib/mailman/Mailman/mm_cfg.py.dist
+link path=usr/lib/mailman/Mailman/mm_cfg.pyc \
+    target=../../../../etc/mailman/mm_cfg.pyc
 file path=usr/lib/mailman/Mailman/versions.py
 link path=usr/lib/mailman/archives/private \
     target=../../../../var/mailman/archives/private
--- a/make-rules/shared-macros.mk	Tue Feb 17 16:34:10 2015 -0800
+++ b/make-rules/shared-macros.mk	Wed Mar 04 15:13:21 2015 -0800
@@ -325,6 +325,7 @@
 
 PYTHON.2.7.32 =	/usr/bin/python2.7
 PYTHON.2.7.64 =	/usr/bin/$(MACH64)/python2.7
+PYTHON.2.7 =	/usr/bin/python2.7
 
 # Although we build Python 3 64-bit only, the BUILD_NO_ARCH macro is written
 # in such a way that we still need the .32 macro below.  And since we build
--- a/transforms/autopyc	Tue Feb 17 16:34:10 2015 -0800
+++ b/transforms/autopyc	Wed Mar 04 15:13:21 2015 -0800
@@ -18,11 +18,16 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Don't bother specifying each .pyc file.  Allow individual actions to
 # override this by setting pkg.tmp.autopyc to false.
+# Note that prior to Python 3, the following covered all .py files.  But since
+# then only files under usr/lib/python[23].* are covered, and any components
+# shipping .py files elsewhere need to specify pkg.tmp.pyversion directly to
+# generate .pyc files.  But that variable really should be private to this
+# file. 20632788 has been filed to fix this.
 <transform file path=.*\.py$ -> default pkg.tmp.autopyc true>
 <transform file hardlink pkg.tmp.autopyc=true path=usr/lib/python2\.(.*)\.py$ -> default pkg.tmp.pyversion 2.X>
 <transform file hardlink pkg.tmp.autopyc=true path=usr/lib/python3\.(.*)/.*\.py$ -> default pkg.tmp.pyversion 3.%<1>>