comparison carton.py @ 38:99c610473c17

if develop fails, go with install
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 09 Apr 2012 13:44:16 -0700
parents 33e5d444ff30
children d9dcc5a1503b
comparison
equal deleted inserted replaced
37:33e5d444ff30 38:99c610473c17
3 """ 3 """
4 make a self-extracting virtualenv from directories or URLs of packages 4 make a self-extracting virtualenv from directories or URLs of packages
5 5
6 To package up all files in a virtualenvs source directory (e.g.):: 6 To package up all files in a virtualenvs source directory (e.g.)::
7 7
8 python path/to/carton.py myproject project/src/* 8 python path/to/carton.py myproject project/src/*
9 9
10 This will create a self-extracting file, `myproject.py`, that will unfold 10 This will create a self-extracting file, `myproject.py`, that will unfold
11 a virtualenv with the specified packages setup for development 11 a virtualenv with the specified packages setup for development
12 12
13 The sources may be directories, local or HTTP-accessible tarballs, or ordinary 13 The sources may be directories, local or HTTP-accessible tarballs, or ordinary
135 for i in os.listdir(srcdir): 135 for i in os.listdir(srcdir):
136 if i in setup_pys: 136 if i in setup_pys:
137 continue 137 continue
138 subdir = os.path.join(srcdir, i) 138 subdir = os.path.join(srcdir, i)
139 if os.path.exists(os.path.join(srcdir, i, 'setup.py')): 139 if os.path.exists(os.path.join(srcdir, i, 'setup.py')):
140 call([python, 'setup.py', 'develop'], cwd=subdir) 140 try:
141 call([python, 'setup.py', 'develop'], cwd=subdir)
142 except:
143 call([python, 'setup.py', 'install'], cwd=subdir)
141 # TODO: try `setup.py install` if develop fails for distutils packages 144 # TODO: try `setup.py install` if develop fails for distutils packages
142 setup_pys.add(i) 145 setup_pys.add(i)
143 146
144 # add virtualenv to the virtualenv (!) 147 # add virtualenv to the virtualenv (!)
145 virtualenv_dir = os.path.dirname(virtualenv) 148 virtualenv_dir = os.path.dirname(virtualenv)