Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Dec 3, 2008
0 parents commit 6267934
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def bootstrap():
local("virtualenv ve")
local("mkdir src")
local("python grab_repos.py")

60 changes: 60 additions & 0 deletions grab_repos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python
"""
1. Parses repo_list.txt
2. Downloads source code to the `src` folder
3. Adds source to `ve` virtualenv PYTHONPATH
"""


import commands

f = open("repo_list.txt")
stat, cwd = commands.getstatusoutput('pwd')


for line in f.readlines():

#ignore comments
if line.startswith('#'):
continue

name, url, vcs, version = line.split()

#SUBVERSION/GIT
if vcs == 'svn' or vcs == 'git':
#if setup.py isn't available use pipe delimiter to determine source directory and python module
#names for symlinking
try:
src_dir, py_module = name.split('|')
ln_cmd = "cd %s/ve/lib/python2.5/site-packages; ln -s ../../../../src/%s/%s ." % (cwd, src_dir, py_module)
except ValueError:
src_dir = name
ln_cmd = 'cd %s; %s/ve/bin/python setup.py install' % (src_dir, cwd)
#TODO handle version/head logic
if vcs == 'svn':
co_cmd = "svn co -r %s %s %s" % (version, url, src_dir)
else: #vcs == git
co_cmd = "git clone %s" % url
#TODO handle branching
cmd = '%s; %s' % (co_cmd, ln_cmd)

#SINGLE FILE DOWNLOAD
elif vcs == 'wget':
co_cmd = "wget %s" % url
ln_cmd = "cd %s/ve/lib/python2.5/site-packages; ln -s ../../../../src/%s ." % (cwd, name)
cmd = '%s; %s' % (co_cmd, ln_cmd)

#CHEESESHOP
elif vcs == 'pypi':
cmd = "easy_install %s==%s" % (name, version)
else:
raise Exception, "Can't handle %s" % vcs
print cmd

#move to `src` directory and run command(s)
stat, output = commands.getstatusoutput('(cd src; %s)' % cmd)
if stat:
raise Exception, '`%s` failed: %s' % (cmd, output)
else:
pass #print output
11 changes: 11 additions & 0 deletions repo_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#name repo vcs version
dateutil http://pypi.python.org/pypi/dateutil pypi 1.1
html2text.py http://www.aaronsw.com/2002/html2text/html2text.py wget 2.34
django-1.0 http://code.djangoproject.com/svn/django/branches/releases/1.0.X svn 9560
gondola|lincolnloop git@lincolnloop.unfuddle.com:lincolnloop/gondola.git git head|master
django-command-extensions http://django-command-extensions.googlecode.com/svn/trunk svn 135
django-registration http://django-registration.googlecode.com/svn/trunk svn 168
sorl-thumbnail|sorl http://sorl-thumbnail.googlecode.com/svn/trunk svn 430
#setup.py fails for tagging without DJANGO_SETTINGS_MODULE defined
django-tagging|tagging http://django-tagging.googlecode.com/svn/trunk svn 149
django-template-utils http://django-template-utils.googlecode.com/svn/trunk svn 109

0 comments on commit 6267934

Please sign in to comment.