Include glade file in distribution.
[zeroinstall/zeroinstall-rsl.git] / makedist
blob57abec459cc46d29928dd7174a50acc8a4a5e1d6
1 #!/usr/bin/env python
2 import zeroinstall, sys, os, shutil, time
3 from zeroinstall.injector import iface_cache, model
5 testing = False
6 if testing: print "TEST MODE!!"
8 trunk_url = 'https://zero-install.svn.sourceforge.net/svnroot/zero-install/trunk/0launch'
9 releases_url = 'https://zero-install.svn.sourceforge.net/svnroot/zero-install/releases/0launch'
11 publish_url = 'http://0install.net/2006/interfaces/0publish'
13 def run(prog, *args):
14 if os.spawnlp(os.P_WAIT, prog, prog, *args):
15 raise Exception('Command failed: %s %s' % (prog, ' '.join(args)))
17 gui_iface_path = 'zeroinstall/0launch-gui/ZeroInstall-GUI.xml'
18 gui_iface = iface_cache.iface_cache.get_interface(os.path.abspath(gui_iface_path))
19 assert len(gui_iface.implementations) == 1
20 gui_impl = gui_iface.implementations.values()[0]
21 if gui_impl.upstream_stability == model.testing:
22 run('0launch', publish_url, '--stable', gui_iface_path)
23 run('0launch', publish_url, '--set-released', time.strftime('%Y-%m-%d'), gui_iface_path)
25 os.system('svn status')
27 if gui_impl.get_version() != zeroinstall.version:
28 print "GUI feed's version is '%s'; should be '%s'" % (gui_impl.get_version(), zeroinstall.version)
29 sys.exit(1)
31 sys.path.insert(0, './zeroinstall/0launch-gui')
32 import gui
33 if gui.version != zeroinstall.version:
34 print "GUI version is %s; should be %s" % (gui.version, zeroinstall.version)
35 sys.exit(1)
36 del sys.path[0]
38 name = 'injector-' + zeroinstall.version
39 package_name = 'zeroinstall-' + name
41 if not testing:
42 a = raw_input("Release " + name + "? [y/N]")
43 if not a or a not in 'Yy':
44 sys.exit(0)
46 for v in []: #['2.3', '2.4', '2.5']:
47 if os.system('cd tests && python%s ./testall.py' % v):
48 print "ERROR: Unit test failure with Python %s. Stop" % v
49 sys.exit(1)
51 print "Checking for existing release..."
52 if testing is False and os.system('svn ls ' + releases_url + '/' + name + ' >/dev/null') == 0:
53 print "WARNING: releases/" + name + " already exists"
54 a = raw_input("Overwrite " + name + "? [y/N]")
55 if not a or a not in 'Yy':
56 sys.exit(0)
57 os.system('svn rm ' + releases_url + '/' + name + ' -m overwrite')
59 if not testing:
60 print "Branching..."
62 if os.system('svn cp -m "Released ' + name + '" ' +
63 trunk_url + ' ' + releases_url + '/' + name):
64 print "Failed to make release"
65 sys.exit(1)
67 if os.path.isdir(package_name):
68 shutil.rmtree(package_name)
70 if testing:
71 os.system('svn export . ' + package_name)
72 else:
73 os.system('svn export ' + releases_url + '/' + name + ' ' + package_name)
74 os.system('svn up')
75 os.chdir(package_name)
76 os.system('python setup.py sdist')
78 tarball = package_name + '/dist/' + package_name + '.tar.gz'
80 if os.system("cd dist && tar xzf '%s.tar.gz' && cd '%s'/tests && ./testall.py" %
81 (package_name, package_name)):
82 print >>sys.stderr, "Unit tests failed in release. Perhaps you need to update MANIFEST.in?"
83 sys.exit(1)
85 print "Tarball is", tarball
86 #print "To build .deb: ./makedeb", tarball
88 if testing:
89 print "TEST MODE IS ON!"