From bb4d689769703177dbb0df0935e15016b879f42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20Sacr=C3=A9?= Date: Tue, 25 Oct 2016 19:20:17 +0200 Subject: python3: Build and package precompiled modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the patch that was applied in the python3 and python3-native recipes to skip compilation of python modules. Modify generate-manifest-3.5.py to match '__pycache__' directories in FILES_*. This is necessary because Python3 puts .pyc files in '__pycache__' subdirectories one level below the corresponding .py files, whereas in Python2 they used to be right next to the sources. This change significantly reduces the startup overhead of Python3 scripts. For example, on a Cortex-A9, "python3 -c pass" took 0.40s before, and 0.19s after. Signed-off-by: Dominic Sacré Signed-off-by: Ross Burton --- scripts/contrib/python/generate-manifest-3.5.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts/contrib/python') diff --git a/scripts/contrib/python/generate-manifest-3.5.py b/scripts/contrib/python/generate-manifest-3.5.py index 2906cc66d0..897768fbaa 100755 --- a/scripts/contrib/python/generate-manifest-3.5.py +++ b/scripts/contrib/python/generate-manifest-3.5.py @@ -59,10 +59,20 @@ class MakefileMaker: for filename in filenames: if filename[0] != "$": fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) ) + fullFilenames.append( "%s%s" % ( self.targetPrefix, + self.pycachePath( filename ) ) ) else: fullFilenames.append( filename ) self.packages[name] = description, dependencies, fullFilenames + def pycachePath( self, filename ): + dirname = os.path.dirname( filename ) + basename = os.path.basename( filename ) + if '.' in basename: + return os.path.join( dirname, '__pycache__', basename ) + else: + return os.path.join( dirname, basename, '__pycache__' ) + def doBody( self ): """generate body of Makefile""" -- cgit v1.2.3