home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 May / maximum-cd-2009-05.iso / DiscContents / XBMC_for_Windows-8.10.exe / system / python / spyce / makefile < prev    next >
Encoding:
Makefile  |  2008-11-03  |  5.7 KB  |  150 lines

  1. PYTHON := $(shell which python)
  2. SPYCE_VERSION = $(shell $(PYTHON) -c "import spyce; print spyce.__version__")
  3. SPYCE_RELEASE = $(shell $(PYTHON) -c "import spyce; print spyce.__release__")
  4.  
  5. SRC := $(wildcard *.py) $(wildcard modules/*.py) $(wildcard tags/*.py)
  6. OTHER := CHANGES LICENCE README THANKS spyceApache.conf spyce.conf.eg spyce.mime
  7. DOC_SRC := $(wildcard docs/*.spy) docs/*.gif docs/examples/*.gif
  8. DOC = $(wildcard docs/*.html) docs/*.gif
  9. EXAMPLES := $(wildcard docs/examples/*.spy) $(wildcard docs/examples/*.spi) $(wildcard docs/examples/*.tmpl) $(wildcard docs/examples/*.py) $(wildcard docs/examples/*.gif)
  10.  
  11. SFUSER := batripler
  12. SFCVSanon := :pserver:anonymous@cvs.spyce.sourceforge.net:/cvsroot/spyce
  13. SFCVSdev := :ext:$(SFUSER)@cvs.sourceforge.net:/cvsroot/spyce
  14. SFCVS := $(SFCVSdev)
  15.  
  16. ssh := ssh -1 -x
  17. scp := scp -o Protocol=1
  18.  
  19. COMPILED = $(SRC:.py=.pyc)
  20.  
  21. # install paths
  22. DESTDIR := /
  23. INSTALL_ROOT := $(DESTDIR)
  24. INSTALL_CODE := $(INSTALL_ROOT)/usr/share
  25.  
  26. RPMROOT := /home/barr/misc/rpm
  27.  
  28. .PHONY: all compile clean remake tgz rpm www
  29.  
  30. all: compile docs
  31.  
  32. # make this a dependency every time you use $PYTHON or $SPYCE_VERSION
  33. versionchk: $(PYTHON)
  34.     $(PYTHON) verchk.py
  35.     touch versionchk
  36.  
  37. clean: versionchk
  38.     -rm versionchk
  39.     -rm -f spyce.spec spyce.nsi
  40.     -rm -f *.pyc
  41.     -rm -f modules/*.pyc
  42.     -rm -f tags/*.pyc
  43.     -rm -f spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz
  44.     -rm -f spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).noarch.rpm
  45.     -rm -f $(RPMROOT)/SOURCES/spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz
  46.     -rm -f $(RPMROOT)/SRPMS/spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).src.rpm
  47.     -rm -f $(RPMROOT)/RPMS/noarch/spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).noarch.rpm
  48.     -rm -rf $(RPMROOT)/BUILD/spyce-$(SPYCE_VERSION)
  49.     -$(MAKE) -C docs clean
  50.  
  51. perm:
  52.     chmod a+r -R .
  53.     chmod a+x . `find . -type d`
  54.     chmod a+x run_*.py verchk.py
  55.  
  56. remake: clean all
  57.  
  58. compile: $(COMPILED)
  59.  
  60. # make documentation
  61. docs: compile
  62.     @$(MAKE) -C docs
  63.  
  64. # make source tarball
  65. tgz: versionchk
  66.     @echo "Making clean source tarball: spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz"
  67.     -rm -rf spyce-$(SPYCE_VERSION)
  68.     cvs -d $(SFCVS) export -d spyce-$(SPYCE_VERSION) -D now spyce
  69.     chmod a+r -R spyce-$(SPYCE_VERSION)
  70.     chmod a+x `find spyce-$(SPYCE_VERSION) -type d`
  71.     chmod a+x spyce-$(SPYCE_VERSION)/run_*.py spyce-$(SPYCE_VERSION)/verchk.py
  72.     # process .nsi.in so that we can just use .tgz to make .exe installer
  73.     cd spyce-$(SPYCE_VERSION); make spyce.nsi; rm -f *.pyc *.pyo; cd ..
  74.     tar --totals -czf spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz spyce-$(SPYCE_VERSION)
  75.     rm -rf spyce-$(SPYCE_VERSION)
  76.  
  77. # make rpm
  78. rpm: versionchk tgz spyce.spec
  79.     cp spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz $(RPMROOT)/SOURCES
  80.     rpmbuild -ba spyce.spec
  81.     cp $(RPMROOT)/RPMS/noarch/spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).noarch.rpm .
  82.  
  83. # install Spyce (used for manual install and by rpm scripts)
  84. install: compile docs
  85.     @echo "Installing Spyce python module in: $(INSTALL_CODE)/spyce"
  86.     @for f in `find . -type d`; do \
  87.         mkdir -p $(INSTALL_CODE)/spyce/$$f; \
  88.         chmod a+rx $(INSTALL_CODE)/spyce/$$f; \
  89.     done
  90.     @for f in $(SRC) $(COMPILED) $(OTHER) $(DOC) $(EXAMPLES); do \
  91.         install -m 644 $$f $(INSTALL_CODE)/spyce/$$f; \
  92.     done
  93.     @chmod a+rx $(INSTALL_CODE)/spyce/run_*.py $(INSTALL_CODE)/spyce/verchk.py
  94.  
  95. # uninstall Spyce (used for manual install and by rpm scripts)
  96. uninstall:
  97.     @echo "Removing main Spyce directory: $(INSTALL_CODE)/spyce"
  98.     @-rm -rf $(INSTALL_CODE)/spyce
  99.  
  100. # generate python compiled (bytecode) files
  101. $(COMPILED): $(SRC)
  102.     $(PYTHON) -c "exec '''import py_compile,string,os\nfor i in string.split('$+', ' '):\n  print 'Compiling: '+i; py_compile.compile(i)\n'''"
  103.  
  104. %.pyc: %.py versionchk
  105.     $(PYTHON) -c "import py_compile; py_compile.compile('$<')"
  106.  
  107. spyce.spec: spyce.spec.in spyce.py
  108.     cat spyce.spec.in | sed "s/__VERSION__/${SPYCE_VERSION}/" | sed "s/__RELEASE__/${SPYCE_RELEASE}/" > spyce.spec
  109.  
  110. spyce.nsi: spyce.nsi.in spyce.py
  111.     cat spyce.nsi.in | sed "s/__VERSION__/${SPYCE_VERSION}/" | sed "s/__RELEASE__/${SPYCE_RELEASE}/" > spyce.nsi
  112.  
  113.  
  114. # update sourceforge
  115. sf: clean tgz compile
  116.     -rm -r www
  117.     mkdir www; mkdir www/htdocs; mkdir www/htdocs/examples; mkdir www/contrib; mkdir www/cgi-bin; mkdir www/cgi-bin/eg
  118.     # docs
  119.     @$(MAKE) -C docs sf
  120.     cp docs/*.html docs/*.gif docs/*.ico www/htdocs
  121.     # examples
  122.     cp docs/examples/*.spy docs/examples/*.spi docs/examples/*.tmpl www/htdocs/examples
  123.     # contribs
  124.     python run_spyceCmd.py -O contrib/*.spy
  125.     cp -r -L contrib/* www/contrib
  126.     pushd www/htdocs; ln -s ../contrib; popd
  127.     # exec
  128.     cp spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz www
  129.     cd www; tar -xzf spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz; mv spyce-$(SPYCE_VERSION) spyce; rm spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz; cd spyce; make compile; cd ../..
  130.     # cgi
  131.     cp docs/examples/*.spy docs/examples/*.spi docs/examples/*.py docs/examples/*.tmpl docs/examples/*.gif www/cgi-bin/eg
  132.     cd www; for f in cgi-bin/eg/*.spy; do spyce/misc/addfirstline.sh $$f '#!/usr/bin/python ../../spyce/run_spyceCGI.py'; done; cd ..
  133.     # package it all up
  134.     tar -czvf www.tgz www/
  135.     -rm -r www
  136.     # send it over
  137.     $(scp) www.tgz $(SFUSER)@shell.sourceforge.net:.
  138.     -rm www.tgz
  139.     make clean
  140.     # unpackage it there
  141.     $(ssh) $(SFUSER)@shell.sourceforge.net 'tar -xzf www.tgz; cd www; chmod -R a+r .; chmod a+x `find . -type d`; chmod a+x cgi-bin/eg/*.spy; cd spyce; make perm; cd ../..; rm www.tgz'
  142.     # out with the old and in with the new
  143.     $(ssh) $(SFUSER)@shell.sourceforge.net 'rm -rf spyce-www/*; mv www/* spyce-www; rmdir www'
  144.  
  145. # upload files to sourceforge file release system
  146. upload: versionchk rpm
  147.     ncftpput upload.sourceforge.net incoming spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).tgz spyce-$(SPYCE_VERSION)-$(SPYCE_RELEASE).noarch.rpm
  148.     make clean
  149.  
  150.