summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Gray <mark.d.gray@redhat.com>2020-11-19 03:44:34 -0500
committerIlya Maximets <i.maximets@ovn.org>2020-11-26 12:18:57 +0100
commitd409f50062a7a72233e00cfe0466228034f8fb31 (patch)
tree6478f04d6c5347147212d80a68bed63ef77ea1ab
parent7bfb1952b9dd4f34fc11706da83e0d7b514420c7 (diff)
downloadopenvswitch-d409f50062a7a72233e00cfe0466228034f8fb31.tar.gz
python: Update build system to ensure dirs.py is created.
Update build system to ensure dirs.py is created when it is a dependency for a build target. Also, update setup.py to check for that dependency. Fixes: 943c4a325045 ("python: set ovs.dirs variables with build system values") Signed-off-by: Mark Gray <mark.d.gray@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/automake.mk2
-rw-r--r--ovsdb/automake.mk2
-rw-r--r--python/automake.mk24
-rw-r--r--python/ovs/.gitignore2
-rw-r--r--python/setup.py9
5 files changed, 24 insertions, 15 deletions
diff --git a/lib/automake.mk b/lib/automake.mk
index 8eeb6c3f6..380a67228 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -575,7 +575,7 @@ MAN_FRAGMENTS += \
OVSIDL_BUILT += lib/vswitch-idl.c lib/vswitch-idl.h lib/vswitch-idl.ovsidl
EXTRA_DIST += lib/vswitch-idl.ann
-lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann python/ovs/dirs.py
+lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann
$(AM_V_GEN)$(OVSDB_IDLC) annotate $(srcdir)/vswitchd/vswitch.ovsschema $(srcdir)/lib/vswitch-idl.ann > $@.tmp && mv $@.tmp $@
lib/dirs.c: lib/dirs.c.in Makefile
diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk
index b895f4292..d60f3f4ec 100644
--- a/ovsdb/automake.mk
+++ b/ovsdb/automake.mk
@@ -106,7 +106,7 @@ CLEANFILES += $(OVSIDL_BUILT)
# However, current versions of Automake seem to output all variable
# assignments before any targets, so it doesn't seem to be a problem,
# at least for now.
-$(OVSIDL_BUILT): ovsdb/ovsdb-idlc.in
+$(OVSIDL_BUILT): ovsdb/ovsdb-idlc.in python/ovs/dirs.py
# ovsdb-doc
EXTRA_DIST += ovsdb/ovsdb-doc
diff --git a/python/automake.mk b/python/automake.mk
index c4382ec60..767512f17 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -74,12 +74,12 @@ ovs-install-data-local:
$(MKDIR_P) python/ovs
sed \
-e '/^##/d' \
- -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
- -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
- -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
- -e 's,[@]bindir[@],$(bindir),g' \
- -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
- -e 's,[@]DBDIR[@],$(DBDIR),g' \
+ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
+ -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
+ -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
+ -e 's,[@]bindir[@],$(bindir),g' \
+ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
+ -e 's,[@]DBDIR[@],$(DBDIR),g' \
< $(srcdir)/python/ovs/dirs.py.template \
> python/ovs/dirs.py.tmp
$(MKDIR_P) $(DESTDIR)$(pkgdatadir)/python/ovs
@@ -107,12 +107,12 @@ ALL_LOCAL += $(srcdir)/python/ovs/dirs.py
$(srcdir)/python/ovs/dirs.py: python/ovs/dirs.py.template
$(AM_V_GEN)sed \
-e '/^##/d' \
- -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
- -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
- -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
- -e 's,[@]bindir[@],$(bindir),g' \
- -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
- -e 's,[@]DBDIR[@],$(sysconfdir)/openvswitch,g' \
+ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
+ -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
+ -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
+ -e 's,[@]bindir[@],$(bindir),g' \
+ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
+ -e 's,[@]DBDIR[@],$(sysconfdir)/openvswitch,g' \
< $? > $@.tmp && \
mv $@.tmp $@
EXTRA_DIST += python/ovs/dirs.py.template
diff --git a/python/ovs/.gitignore b/python/ovs/.gitignore
index 51030beca..8bbcd824f 100644
--- a/python/ovs/.gitignore
+++ b/python/ovs/.gitignore
@@ -1,2 +1,2 @@
version.py
-dir.py
+dirs.py
diff --git a/python/setup.py b/python/setup.py
index b7252800c..d385d8372 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -30,6 +30,15 @@ except IOError:
file=sys.stderr)
sys.exit(-1)
+try:
+ # Try to open generated ovs/dirs.py. However, in this case we
+ # don't need to exec()
+ open("ovs/dirs.py")
+except IOError:
+ print("Ensure dirs.py is created by running make python/ovs/dirs.py",
+ file=sys.stderr)
+ sys.exit(-1)
+
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
if sys.platform == 'win32':
ext_errors += (IOError, ValueError)