Release 0.8
[0release.git] / setup.py
blobc3d3c9c5ec3a3ae415df82d98d2a05a086fcdc74
1 # Copyright (C) 2007, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
4 import os, sys
5 from zeroinstall import SafeException
6 from zeroinstall.injector import reader, model
8 release_uri = 'http://0install.net/2007/interfaces/0release.xml'
10 umask = os.umask(0)
11 os.umask(umask)
13 def init_releases_directory(iface):
14 files = os.listdir('.')
15 if files:
16 raise SafeException("This command must be run from an empty directory!\n(this one contains %s)" % (', '.join(files[:5])))
18 print "Setting up releases directory for %s" % iface.get_name()
20 master_feed_name = iface.get_name().replace(' ', '-') + '.xml'
22 make_release = file('make-release', 'w')
23 make_release.write("""#!/bin/sh
25 # The directory people will download the releases from.
26 # This will appear in the remote feed file.
27 #ARCHIVE_DIR_PUBLIC_URL=http://placeholder.org/releases
28 ARCHIVE_DIR_PUBLIC_URL=
30 # The path to the main feed.
31 # The new version is added here when you publish a release.
32 #MASTER_FEED_FILE="$HOME/public_html/feeds/MyProg.xml"
33 MASTER_FEED_FILE="%s"
35 # A shell command to upload the generated archive file to the
36 # public server (corresponds to $ARCHIVE_DIR_PUBLIC_URL, which is
37 # used to download it again).
38 # If unset, you'll have to upload it yourself.
39 #ARCHIVE_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/releases/'
40 ARCHIVE_UPLOAD_COMMAND=
42 # A shell command to upload the master feed ($MASTER_FEED_FILE) and
43 # related files to your web server. It will be downloaded using the
44 # feed's URL. If unset, you'll have to upload it yourself.
45 #MASTER_FEED_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/feeds/'
46 MASTER_FEED_UPLOAD_COMMAND=
48 # Your public version control repository. When publishing, the new
49 # HEAD and the release tag will be pushed to this using a command
50 # such as "git-push main master v0.1"
51 # If unset, you'll have to update it yourself.
52 #PUBLIC_SCM_REPOSITORY=main
53 PUBLIC_SCM_REPOSITORY=
55 cd `dirname "$0"`
56 exec 0launch %s --release %s \\
57 --archive-dir-public-url="$ARCHIVE_DIR_PUBLIC_URL" \\
58 --master-feed-file="$MASTER_FEED_FILE" \\
59 --archive-upload-command="$ARCHIVE_UPLOAD_COMMAND" \\
60 --master-feed-upload-command="$MASTER_FEED_UPLOAD_COMMAND" \\
61 --public-scm-repository="$PUBLIC_SCM_REPOSITORY" \\
62 "$@"
63 """ % (master_feed_name, release_uri, iface.uri))
64 make_release.close()
65 os.chmod('make-release', 0775 & ~umask)
66 print "Success - created script:\n %s\nNow edit it with your local settings." % os.path.abspath('make-release')
67 print "Then, create new releases by running it."