-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
60 lines (49 loc) · 1.95 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (C) 2007, Thomas Leonard
# See the README file for details, or visit http://0install.net.
import os
from zeroinstall import SafeException
release_uri = 'http://0install.net/2007/interfaces/0release.xml'
umask = os.umask(0)
os.umask(umask)
def init_releases_directory(feed):
files = os.listdir('.')
if files:
raise SafeException("This command must be run from an empty directory!\n(this one contains %s)" % (', '.join(files[:5])))
print("Setting up releases directory for %s" % feed.get_name())
master_feed_name = feed.get_name().replace(' ', '-') + '.xml'
if os.name == 'nt':
with open('make-release.bat', 'w') as make_release:
make_release.write("""@echo off
:: Your public version control repository. When publishing, the new
:: HEAD and the release tag will be pushed to this using a command
:: such as "git push origin master v0.1"
:: If unset, you'll have to update it yourself.
::set PUBLIC_SCM_REPOSITORY=origin
set PUBLIC_SCM_REPOSITORY=
cd /d "%%~dp0"
0launch %s --release %s ^
--public-scm-repository="%%PUBLIC_SCM_REPOSITORY%%" ^
%%*
""" % (master_feed_name, release_uri, feed.local_path))
make_release.close()
print("Success - created script:\n %s" % os.path.abspath('make-release.bat'))
else:
with open('make-release', 'w') as make_release:
make_release.write("""#!/bin/sh
# Your public version control repository. When publishing, the new
# HEAD and the release tag will be pushed to this using a command
# such as "git push origin master v0.1"
# If unset, you'll have to update it yourself.
#PUBLIC_SCM_REPOSITORY=origin
PUBLIC_SCM_REPOSITORY=
cd `dirname "$0"`
exec 0launch %s \\
--release %s \\
--public-scm-repository="$PUBLIC_SCM_REPOSITORY" \\
"$@"
""" % (release_uri, feed.local_path))
make_release.close()
os.chmod('make-release', 0o775 & ~umask)
print("Success - created script:\n %s" % os.path.abspath('make-release'))
print("Now edit it with your local settings.")
print("Then, create new releases by running it.")