thanks! On Fri, Apr 17, 2020 at 8:04 PM <jonas.hahnf...@gmail.com> wrote: > > Reviewers: lemzwerg, Jean-Charles, hanwenn, > > Message: > pushed: > commit 3b2941a9bd90797e05b0df075c6146b84b6c0062 > Author: Jonas Hahnfeld <hah...@hahnjo.de> > AuthorDate: Thu Apr 16 19:28:07 2020 +0200 > Commit: Jonas Hahnfeld <hah...@hahnjo.de> > CommitDate: Fri Apr 17 20:00:24 2020 +0200 > > Issue 5910: python: Fix compile for in-tree builds > > Without a separate build tree the source files have relative paths, > so the build rules must not change the directory. > > Description: > python: Fix compile for in-tree builds > > Without a separate build tree the source files have relative paths, > so the build rules must not change the directory. > > Please review this at https://codereview.appspot.com/581910043/ > > Affected files (+7, -5 lines): > M python/GNUmakefile > M scripts/build/compile.py > > > Index: python/GNUmakefile > diff --git a/python/GNUmakefile b/python/GNUmakefile > index > a80baa2716c26492e6ebcd63e95f56f5a483e551..f7aa42bb988da371623ae875779fdae100a5c11b > 100644 > --- a/python/GNUmakefile > +++ b/python/GNUmakefile > @@ -11,7 +11,7 @@ include $(depth)/make/stepmake.make > $(outdir)/%.pyc.dummy: %.py > $(call ly_progress,Making,$@,(py compile)) > # Do not use buildscript-dir, this has not been traversed yet. > - cd $(outdir) && $(PYTHON) $(top-src-dir)/scripts/build/compile.py $< > + $(PYTHON) $(top-src-dir)/scripts/build/compile.py $< $(outdir) > touch $@ > > default: $(PY_MODULES_IN:%.py=$(outdir)/%.pyc.dummy) > Index: scripts/build/compile.py > diff --git a/scripts/build/compile.py b/scripts/build/compile.py > index > f3ea6b30304227d48fdfc20487f8f84fd26a2dbd..c1ad29afefb8709d0319ffe0991922230fe1442c > 100644 > --- a/scripts/build/compile.py > +++ b/scripts/build/compile.py > @@ -1,17 +1,19 @@ > #!@PYTHON@ > > from importlib.util import cache_from_source > -from os.path import basename > +import os.path > import py_compile > import sys > > -if len (sys.argv) != 2: > - print ('Usage: compile.py <module.py>') > +if len (sys.argv) != 3: > + print ('Usage: compile.py <module.py> <outdir>') > sys.exit (1) > > src = sys.argv[1] > +outdir = sys.argv[2] > > # Compile src file, but store result in current directory. > > -cfile = cache_from_source (basename(src)) > +cfile = cache_from_source (os.path.basename (src)) > +cfile = os.path.join (outdir, cfile) > py_compile.compile (src, cfile=cfile, doraise=True) > >
-- Han-Wen Nienhuys - hanw...@gmail.com - http://www.xs4all.nl/~hanwen