|
Revision 2335, 1.4 kB
(checked in by kevin, 2 years ago)
|
fixes the site_resources url
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/usr/bin/env python |
|---|
| 2 |
|
|---|
| 3 |
import os |
|---|
| 4 |
import sys |
|---|
| 5 |
import subprocess |
|---|
| 6 |
import re |
|---|
| 7 |
|
|---|
| 8 |
externals = {"site_resources" : "http://svn.turbogears.org/site_resources/", |
|---|
| 9 |
"ez_setup" : "svn://svn.eby-sarna.com/svnroot/ez_setup/", |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
urlline = re.compile("^URL: (.*)") |
|---|
| 13 |
|
|---|
| 14 |
def update(proj): |
|---|
| 15 |
os.chdir(proj) |
|---|
| 16 |
svninfo = subprocess.Popen(["svn", "info"], stdout=subprocess.PIPE) |
|---|
| 17 |
out = svninfo.stdout |
|---|
| 18 |
line = out.readline() |
|---|
| 19 |
while line: |
|---|
| 20 |
line = out.readline() |
|---|
| 21 |
url = urlline.match(line) |
|---|
| 22 |
if url: |
|---|
| 23 |
url = url.group(1).strip() |
|---|
| 24 |
if url != externals[proj] and url != externals[proj][:-1]: |
|---|
| 25 |
print "Switching project %s to %s" % (proj, externals[proj]) |
|---|
| 26 |
svnswitch = subprocess.call(["svn", "switch", externals[proj], "."]) |
|---|
| 27 |
else: |
|---|
| 28 |
print "Updating project %s" % (proj) |
|---|
| 29 |
svnupdate = subprocess.call(["svn", "update"]) |
|---|
| 30 |
break |
|---|
| 31 |
if not url: |
|---|
| 32 |
print "Error! Unable to find URL for project %s" |
|---|
| 33 |
os.chdir("..") |
|---|
| 34 |
|
|---|
| 35 |
def checkout(proj): |
|---|
| 36 |
print "Checking out %s" % (proj) |
|---|
| 37 |
svncheckout = subprocess.call(["svn", "checkout", externals[proj], proj]) |
|---|
| 38 |
|
|---|
| 39 |
def run(): |
|---|
| 40 |
if not os.path.exists("externals.py"): |
|---|
| 41 |
print "You must run this script from the top directory." |
|---|
| 42 |
sys.exit(1) |
|---|
| 43 |
|
|---|
| 44 |
for proj in externals: |
|---|
| 45 |
if os.path.exists(proj): |
|---|
| 46 |
update(proj) |
|---|
| 47 |
else: |
|---|
| 48 |
checkout(proj) |
|---|
| 49 |
|
|---|
| 50 |
if __name__ == "__main__": |
|---|
| 51 |
run() |
|---|