Skip to content

Commit

Permalink
python: Update build system to ensure dirs.py is created
Browse files Browse the repository at this point in the history
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>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
markdgray authored and ovsrobot committed Nov 19, 2020
1 parent 7bfb195 commit 9238c4f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/automake.mk
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/automake.mk
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions python/automake.mk
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/ovs/.gitignore
@@ -1,2 +1,2 @@
version.py
dir.py
dirs.py
9 changes: 9 additions & 0 deletions python/setup.py
Expand Up @@ -30,6 +30,15 @@
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)
Expand Down

0 comments on commit 9238c4f

Please sign in to comment.