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