[PATCH] Fix issues with auto* and version.py
David Shea
dshea at redhat.com
Tue May 27 15:31:31 UTC 2014
automake is really kind of terrible at python.
Filter the generated version.py out of the dist files so that builds
from a dist tarball don't end up with a both a $srcdir and $builddir
copy of version.py. Ignore a pylint error about importing version since
version.py ends up in a different directory than the rest of the
pyanaconda module.
---
pyanaconda/Makefile.am | 6 +++++-
pyanaconda/startup_utils.py | 5 ++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/Makefile.am b/pyanaconda/Makefile.am
index eeac1ae..2d48bd2 100644
--- a/pyanaconda/Makefile.am
+++ b/pyanaconda/Makefile.am
@@ -24,4 +24,8 @@ MAINTAINERCLEANFILES = Makefile.in
# anaconda Python code
pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
anacondadir = $(pkgpyexecdir)
-anaconda_PYTHON = $(sort $(wildcard $(srcdir)/*.py $(builddir)/version.py))
+
+# Filter version.py out of the distributed python files since it will
+# be generated by the configure script
+anaconda_PYTHON = $(filter-out %/version.py,$(wildcard $(srcdir)/*.py))
+nodist_anaconda_PYTHON = $(builddir)/version.py
diff --git a/pyanaconda/startup_utils.py b/pyanaconda/startup_utils.py
index 1c04082..30d5974 100644
--- a/pyanaconda/startup_utils.py
+++ b/pyanaconda/startup_utils.py
@@ -70,7 +70,10 @@ def get_anaconda_version_string():
# non-necessary stuff; we also need to handle the possibility of the
# import itself failing
if module_exists("pyanaconda.version"):
- from pyanaconda import version
+ # Ignore pylint not finding the version module, since thanks to automake
+ # there's a good chance that version.py is not in the same directory as
+ # the rest of pyanaconda.
+ from pyanaconda import version # pylint: disable=no-name-in-module
return version.__version__
else:
return "unknown"
--
1.9.3
More information about the anaconda-patches
mailing list