Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1401)

Issue 581910043: python: Fix compile for in-tree builds (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years ago by hahnjo
Modified:
4 years ago
CC:
lilypond-devel_gnu.org
Visibility:
Public.

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.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -5 lines) Patch
M python/GNUmakefile View 1 chunk +1 line, -1 line 0 comments Download
M scripts/build/compile.py View 1 chunk +6 lines, -4 lines 0 comments Download

Messages

Total messages: 5
lemzwerg
LGTM
4 years ago (2020-04-16 18:35:09 UTC) #1
Jean-Charles
Thanks Jonas, it works like a charm. If it doesn't break out-tree build, I think ...
4 years ago (2020-04-17 16:23:38 UTC) #2
hanwenn
LGTM Please push immediately; all my QA scripting is broken at the moment.
4 years ago (2020-04-17 17:36:06 UTC) #3
hahnjo
pushed: commit 3b2941a9bd90797e05b0df075c6146b84b6c0062 Author: Jonas Hahnfeld <hahnjo@hahnjo.de> AuthorDate: Thu Apr 16 19:28:07 2020 +0200 Commit: ...
4 years ago (2020-04-17 18:04:52 UTC) #4
hanwenn
4 years ago (2020-04-17 18:05:21 UTC) #5
thanks!

On Fri, Apr 17, 2020 at 8:04 PM <jonas.hahnfeld@gmail.com> wrote:
>
> Reviewers: lemzwerg, Jean-Charles, hanwenn,
>
> Message:
> pushed:
> commit 3b2941a9bd90797e05b0df075c6146b84b6c0062
> Author:     Jonas Hahnfeld <hahnjo@hahnjo.de>
> AuthorDate: Thu Apr 16 19:28:07 2020 +0200
> Commit:     Jonas Hahnfeld <hahnjo@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 - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b