lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 5565: simplify python-related makefiles (issue 581080044 by addres


From: nine . fierce . ballads
Subject: Issue 5565: simplify python-related makefiles (issue 581080044 by address@hidden)
Date: Wed, 02 Oct 2019 15:12:38 -0700

Reviewers: ,

Description:
https://sourceforge.net/p/testlilyissues/issues/5565/

Avoid encoding unnecessary details of Python compilation into the
build rules.  Remove some cruft.

I hope that these changes will work equally well with Python 2 and 3,
but I have only tested in an environment with 2.

Please review this at https://codereview.appspot.com/581080044/

Affected files (+11, -30 lines):
  M stepmake/stepmake/python-module-rules.make
  M stepmake/stepmake/python-module-targets.make
  M stepmake/stepmake/python-module-vars.make


Index: stepmake/stepmake/python-module-rules.make
diff --git a/stepmake/stepmake/python-module-rules.make b/stepmake/stepmake/python-module-rules.make index bf99f8feaa569204a5a343601ff98895705452eb..88c7590060d5929a4f6b5c9ba30a8129f0582394 100644
--- a/stepmake/stepmake/python-module-rules.make
+++ b/stepmake/stepmake/python-module-rules.make
@@ -1,14 +1,12 @@
-
-$(outdir)/%$(SHARED_MODULE_SUFFIX): $(outdir)/%.lo
-       $(LD) -o $@ $< $(SHARED_FLAGS) $(ALL_LDFLAGS)
-
-$(outdir)/%.pyc: $(outdir)/%.py
- PYTHONOPTIMIZE= $(PYTHON) -c 'import py_compile; py_compile.compile ("$<")'
-
-$(outdir)/%.pyo: $(outdir)/%.py
-       $(PYTHON) -O -c 'import py_compile; py_compile.compile ("$<")'
-
+.DELETE_ON_ERROR:
+
+# Different versions of Python compile to different places.  We ignore
+# those details and base build dependencies on the *.py script alone.
+# Whenever the script is updated, we also try to compile it.  If
+# compilation fails, make removes the script (because of
+# .DELETE_ON_ERROR:) so that this recipe will be retried the next time
+# make is invoked.
 $(outdir)/%.py: %.py $(config_make) $(depth)/VERSION
-       cat $< | sed $(sed-atfiles) | sed $(sed-atvariables) > $@
+       sed $(sed-atfiles) < $< | sed $(sed-atvariables) > $@
+ PYTHONOPTIMIZE= $(PYTHON) -c 'import py_compile; py_compile.compile ("$@", doraise=True)'
        chmod 755 $@
-
Index: stepmake/stepmake/python-module-targets.make
diff --git a/stepmake/stepmake/python-module-targets.make b/stepmake/stepmake/python-module-targets.make index 44bde97e2fb7177a499125fed66a8bf299b21f03..09e6d2e349fbe590a6eae1bb7b4846bd63306973 100644
--- a/stepmake/stepmake/python-module-targets.make
+++ b/stepmake/stepmake/python-module-targets.make
@@ -1 +1 @@
-default: $(OUT_PY_MODULES) $(OUT_PYC_MODULES) $(OUT_SO_MODULES)
+default: $(OUT_PY_MODULES)
Index: stepmake/stepmake/python-module-vars.make
diff --git a/stepmake/stepmake/python-module-vars.make b/stepmake/stepmake/python-module-vars.make index fc6ea3fb8a087de804f6fe5f3943edfbb06ec1d9..14d9742ca57ec87fba7127b1ac8b392efe88983b 100644
--- a/stepmake/stepmake/python-module-vars.make
+++ b/stepmake/stepmake/python-module-vars.make
@@ -1,19 +1,2 @@
-ALL_LDFLAGS = $(LDFLAGS)
 PY_MODULES_IN = $(call src-wildcard,*.py)
 OUT_PY_MODULES = $(PY_MODULES_IN:%=$(outdir)/%)
-OUT_PYC_MODULES = $(OUT_PY_MODULES:%.py=%.pyc)
-OUT_PYO_MODULES = $(OUT_PY_MODULES:%.py=%.pyo)
-ifeq ($(MINGW_BUILD)$(CYGWIN_BUILD),)
-SHARED_MODULE_SUFFIX = .so
-else
-ifneq ($(CYGWIN_BUILD),)
-SHARED_MODULE_SUFFIX = .dll
-endif
-ifneq ($(MINGW_BUILD),)
-SHARED_MODULE_SUFFIX = .dll
-endif
-endif
-ifneq ($(DARWIN_BUILD),)
-SHARED_FLAGS = -bundle -flat_namespace -undefined suppress
-endif
-OUT_SO_MODULES = $(addprefix $(outdir)/, $(C_FILES:.c=$(SHARED_MODULE_SUFFIX)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]