Use PYTHONDONTWRITEBYTECODE=yes for invoking Python for build or test.
[sliver-openvswitch.git] / python / automake.mk
1 ovstest_pyfiles = \
2         python/ovstest/__init__.py \
3         python/ovstest/args.py \
4         python/ovstest/rpcserver.py \
5         python/ovstest/tcp.py \
6         python/ovstest/udp.py \
7         python/ovstest/util.py \
8         python/ovstest/vswitch.py
9
10 ovs_pyfiles = \
11         python/ovs/__init__.py \
12         python/ovs/daemon.py \
13         python/ovs/db/__init__.py \
14         python/ovs/db/data.py \
15         python/ovs/db/error.py \
16         python/ovs/db/idl.py \
17         python/ovs/db/parser.py \
18         python/ovs/db/schema.py \
19         python/ovs/db/types.py \
20         python/ovs/fatal_signal.py \
21         python/ovs/json.py \
22         python/ovs/jsonrpc.py \
23         python/ovs/ovsuuid.py \
24         python/ovs/poller.py \
25         python/ovs/process.py \
26         python/ovs/reconnect.py \
27         python/ovs/socket_util.py \
28         python/ovs/stream.py \
29         python/ovs/timeval.py \
30         python/ovs/unixctl.py \
31         python/ovs/util.py \
32         python/ovs/version.py \
33         python/ovs/vlog.py
34
35 PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
36 EXTRA_DIST += $(PYFILES)
37 PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
38
39 if HAVE_PYTHON
40 nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
41 ovs-install-data-local:
42         $(MKDIR_P) python/ovs
43         (echo "import os" && \
44          echo 'PKGDATADIR = os.environ.get("OVS_PKGDATADIR", """$(pkgdatadir)""")' && \
45          echo 'RUNDIR = os.environ.get("OVS_RUNDIR", """@RUNDIR@""")' && \
46          echo 'LOGDIR = os.environ.get("OVS_LOGDIR", """@LOGDIR@""")' && \
47          echo 'BINDIR = os.environ.get("OVS_BINDIR", """$(bindir)""")') \
48                 > python/ovs/dirs.py.tmp
49         $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/python/ovs
50         $(INSTALL_DATA) python/ovs/dirs.py.tmp $(DESTDIR)$(pkgdatadir)/python/ovs/dirs.py
51         rm python/ovs/dirs.py.tmp
52 else
53 ovs-install-data-local:
54         @:
55 endif
56 install-data-local: ovs-install-data-local
57
58 UNINSTALL_LOCAL += ovs-uninstall-local
59 ovs-uninstall-local:
60         rm -f $(DESTDIR)$(pkgdatadir)/python/ovs/dirs.py
61
62 ALL_LOCAL += $(srcdir)/python/ovs/version.py
63 $(srcdir)/python/ovs/version.py: config.status
64         $(ro_shell) > $(@F).tmp
65         echo 'VERSION = "$(VERSION)"' >> $(@F).tmp
66         if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp $@; fi