2 # (Re)builds Python metafiles (__init__.py) and documentation
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2005 The Trustees of Princeton University
8 # python-pycurl and python-psycopg2 avail. from fedora 5
9 # we used to ship our own version of psycopg2 and pycurl, for fedora4
10 # starting with 5.0, support for these two modules is taken out
12 # Other stuff - doc not implicit, it's redone by myplc-docs
14 # autoconf compatible variables
22 python3 setup.py build
24 # do the install sequentially
25 # when defining 2 separate targets, that get run in parallel
26 # we observe that the rsync for xmlrpc somehow gets erased and
27 # we suspect pip install to do some cleanup at the end...
29 # we mention --upgrade because otherwise
30 # pip install complains the php/ target already exists
31 # and it refuses to put plc_api.php in there
32 pip install --upgrade --target $(DESTDIR)/$(datadir)/plc_api .
33 # it's important that plcsh sits in /usr/share/plc_api
34 # and not under bin/ so that python can find the PLC/ modules
35 mv $(DESTDIR)/$(datadir)/plc_api/bin/plcsh $(DESTDIR)/$(datadir)/plc_api
36 mv $(DESTDIR)/$(datadir)/plc_api/bin/Server.py $(DESTDIR)/$(datadir)/plc_api
37 # the old recipe used to read
38 # python3 setup.py install \
39 # --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
40 # --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
41 # --install-data=$(DESTDIR)/$(datadir)/plc_api
42 # phpxmlrpc is a git subtree; we just ship all its contents
43 # under /usr/share/plc_api/php/phpxmlrpc
44 mkdir -p $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
45 rsync --exclude .git -ai php/phpxmlrpc/ $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
48 find . -name '*.pyc' | xargs rm -f
49 python3 setup.py clean && rm -rf build
52 echo "This step is obsolete"
58 .PHONY: all install force clean index tags
60 #################### devel tools
62 find . '(' -name '*.py' -o -name '*.sql' -o -name '*.php' -o -name Makefile -o -name '[0-9][0-9][0-9]*' ')' | fgrep -v '.git/' | xargs etags
67 # 2 forms are supported
68 # (*) if your plc root context has direct ssh access:
69 # make sync PLC=private.one-lab.org
70 # (*) otherwise, for test deployments, use on your testmaster
72 # and cut'n paste the export lines before you run make sync
76 SSHCOMMAND:=ssh root@$(PLC)
79 SSHURL:=root@$(PLCHOSTLXC):/vservers/$(GUESTNAME)
80 SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh -o StrictHostKeyChecking=no -o LogLevel=quiet $(GUESTHOSTNAME)
84 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude Accessors_site.py
85 RSYNC_EXCLUDES := --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
86 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
87 RSYNC := rsync -ai $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
91 @echo "sync: I need more info from the command line, e.g."
92 @echo " make sync PLC=boot.planetlab.eu"
93 @echo " make sync PLCHOSTLXC=.. GUESTHOSTNAME=.. GUESTNAME=.."
96 +$(RSYNC) plcsh PLC planetlab5.sql migrations php $(SSHURL)/usr/share/plc_api/
97 +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
98 +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
99 +$(RSYNC) apache/plc.wsgi $(SSHURL)/usr/share/plc_api/apache/
100 $(SSHCOMMAND) systemctl restart plc
103 #################### convenience, for debugging only
104 # make +foo : prints the value of $(foo)
105 # make ++foo : idem but verbose, i.e. foo=$(foo)
106 ++%: varname=$(subst +,,$@)
108 @echo "$(varname)=$($(varname))"
109 +%: varname=$(subst +,,$@)
111 @echo "$($(varname))"