4 # version.py of releases is embedded somewhere
8 # files from utils/misc must be included in this directory if I want a redistributable
12 # This is a general script for building distribution of mentor project
13 # the following options are available:
14 # build.py website - builds html pages for output to sourceforge repository
15 # using rest2html (restructuredText)
16 # from website and doc directories
17 # build.py egg - builds an egg out of python to be installed by setuptools
20 # build.py source - builds source distribution Releases/source.zip and Releases/source.tar.gz
21 # for building manually under windows and linux
22 # instructions and prerequisites for building are detailed in INSTALL file
23 # build.py windows - builds windows binary and nsis/nullsoft installer
25 # build.py deb - creates a debian deb file for automatic debian/ubuntu package installation
26 # build.py rpm - creates a rpm file for automatic fedora/redhat/opensuse installation
27 # build.py all - all of the above are built automatically
29 # build.py tests - run all unittests and doctests for source files
35 # add current version number to releases
43 from src
.utils
import save_stamped_buildno
, delete_stamped_buildno
45 # generating mentor_rc if necessary
46 if not os
.path
.isfile('src/mentor_rc.py'):
47 print "Generating resources file..."
49 f
= open("mentor_rc.py", "wt")
50 subprocess
.call("pyrcc4.exe mentor.qrc", stdout
=f
)
55 print "Generating new version number..."
56 save_stamped_buildno()
60 def removetree(dirname
):
61 if os
.path
.isdir(dirname
):
62 shutil
.rmtree(dirname
)
68 print "Building exe file..."
69 subprocess
.call("python.exe setup.py py2exe")
71 print "Building doc file..."
72 subprocess
.call("c:/Programs/MiKTeX/miktex/bin/latex.exe -output-directory=dist doc/mentor.tex")
73 subprocess
.call("c:/Programs/MiKTeX/miktex/bin/dvipdfm.exe -o dist/mentor.pdf dist/mentor.dvi")
74 os
.remove("dist/mentor.aux")
75 os
.remove("dist/mentor.dvi")
76 os
.remove("dist/mentor.log")
80 print "Clearing temp files..."
81 removetree("../../Releases/current/dist")
84 print "Moving dist to Releases..."
85 removetree("../../Releases/current")
86 shutil
.move("dist", "../../Releases/current")
89 # This deletes the stamp to avoid showing build number
90 # in non built version
91 delete_stamped_buildno()