diff mbox series

[ovs-dev,v3] python: Update build system to ensure dirs.py is created

Message ID 20201119084434.461714-1-mark.d.gray@redhat.com
State Accepted
Headers show
Series [ovs-dev,v3] python: Update build system to ensure dirs.py is created | expand

Commit Message

Mark Gray Nov. 19, 2020, 8:44 a.m. UTC
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.

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---

v2: Added v2 tag
v3: Updated as per Ilya's comments

 lib/automake.mk       |  2 +-
 ovsdb/automake.mk     |  2 +-
 python/automake.mk    | 24 ++++++++++++------------
 python/ovs/.gitignore |  2 +-
 python/setup.py       |  9 +++++++++
 5 files changed, 24 insertions(+), 15 deletions(-)

Comments

Mark Gray Nov. 23, 2020, 6:02 p.m. UTC | #1
On 19/11/2020 08:44, Mark Gray wrote:
> 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.
> 
> Signed-off-by: Mark Gray <mark.d.gray@redhat.com>

FWIW: Here is a link to a passing travis build:

https://travis-ci.com/github/markdgray/ovs/builds/202451550

and appveyor

https://ci.appveyor.com/project/markdgray/ovs-9qglw/builds/36384631
Ilya Maximets Nov. 26, 2020, 12:56 p.m. UTC | #2
On 11/23/20 7:02 PM, Mark Gray wrote:
> On 19/11/2020 08:44, Mark Gray wrote:
>> 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.
>>
>> Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
> 
> FWIW: Here is a link to a passing travis build:
> 
> https://travis-ci.com/github/markdgray/ovs/builds/202451550
> 
> and appveyor
> 
> https://ci.appveyor.com/project/markdgray/ovs-9qglw/builds/36384631

Thanks!

Seems like this fixes the windows build and it actually looks good to me.

Applied to master.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/automake.mk b/lib/automake.mk
index 8eeb6c3f676c..380a672287ac 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 b895f42925ef..d60f3f4ec8cb 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 c4382ec60928..767512f1757f 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 51030beca437..8bbcd824f472 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 b7252800c1c1..d385d8372239 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)