2 ## (Re)builds Python metafile (__init__.py)
4 # overwritten by the specfile
10 install: python-install wsdl-install xmlbuilder-install tests-install
12 clean: python-clean wsdl-clean
14 uninstall: python-uninstall tests-uninstall
16 .PHONY: all install clean uninstall
18 VERSIONTAG=should-be-redefined-by-specfile
23 version: sfa/util/version.py
24 sfa/util/version.py: sfa/util/version.py.in
25 sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" sfa/util/version.py.in > $@
28 cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
31 python setup.py install --root=$(DESTDIR)
32 chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
34 python-clean: version-clean
39 rm -f sfa/util/version.py
41 .PHONY: python version python-install python-clean version-clean xmlbuilder-install
46 # propagate DESTDIR from the specfile
48 $(MAKE) -C wsdl install
53 .PHONY: wsdl wsdl-install wsdl-clean
57 mkdir -p $(DESTDIR)/usr/share/sfa/tests
58 install -m 755 tests/*.py $(DESTDIR)/usr/share/sfa/tests/
61 rm -rf $(DESTDIR)/usr/share/sfa/tests
63 .PHONY: tests-install tests-uninstall
65 ########## refreshing methods package metafile
66 # Metafiles - manage Legacy/ and Accessors by hand
67 init := sfa/methods/__init__.py
74 methods_now := $(sort $(shell fgrep -v '"' sfa/methods/__init__.py 2>/dev/null))
75 # what should be declared
76 methods_paths := $(filter-out %/__init__.py, $(wildcard sfa/methods/*.py))
77 methods_files := $(sort $(notdir $(methods_paths:.py=)))
79 ifneq ($(methods_now),$(methods_files))
80 sfa/methods/__init__.py: force
82 sfa/methods/__init__.py:
83 (echo '## Please use make index to update this file' ; echo 'all = """' ; cd sfa/methods; ls -1 *.py | grep -v __init__ | sed -e 's,.py$$,,' ; echo '""".split()') > $@
89 find . -type f | egrep -v '/\.git/|/\.svn/|TAGS|\.py[co]$$|\.doc$$|\.html$$|\.pdf$$|~$$' | xargs etags
93 (cd sfa/methods; grep 'def.*call' *.py > SIGNATURES)
97 # 2 forms are supported
98 # (*) if your plc root context has direct ssh access:
99 # make sync PLC=private.one-lab.org
100 # (*) otherwise, entering through the root context
101 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
103 PLCHOST ?= testplc.onelab.eu
107 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
108 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
112 SSHURL:=root@$(PLC):/
113 SSHCOMMAND:=ssh root@$(PLC)
116 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
117 RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
118 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
119 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
121 BINS = ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
122 ./sfa/plc/sfa-import-plc.py ./sfa/plc/sfa-nuke-plc.py ./sfa/server/sfa-server.py \
123 ./sfa/client/sfi.py ./sfa/client/getNodes.py ./sfa/client/getRecord.py \
124 ./sfa/client/setRecord.py ./sfa/client/sfadump.py
128 @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
129 @echo " e.g. make sync PLC=private.one-lab.org"
130 @echo " or make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
133 +$(RSYNC) ./sfa/ $(SSHURL)/usr/lib\*/python2.\*/site-packages/sfa/
134 +$(RSYNC) ./tests/ $(SSHURL)/root/tests-sfa
135 +$(RSYNC) $(BINS) $(SSHURL)/usr/bin
136 $(SSHCOMMAND) exec service sfa restart