Mercurial > hg > carton
comparison carton.py @ 3:75919adb199a
use compression, but it doesnt seem to help much
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 08 Jul 2011 09:38:15 -0700 |
parents | 1c7da6388dd9 |
children | 79f332fb3275 |
comparison
equal
deleted
inserted
replaced
2:dba783d48eae | 3:75919adb199a |
---|---|
43 | 43 |
44 # virtualenv name | 44 # virtualenv name |
45 ENV='''%(ENV)s''' | 45 ENV='''%(ENV)s''' |
46 | 46 |
47 # packed files | 47 # packed files |
48 VIRTUAL_ENV='''%(VIRTUAL_ENV)s'''.decode('base64') | 48 VIRTUAL_ENV='''%(VIRTUAL_ENV)s'''.decode('base64').decode('zlib') |
49 PACKAGE_SOURCES='''%(PACKAGE_SOURCES)s'''.decode('base64') | 49 PACKAGE_SOURCES='''%(PACKAGE_SOURCES)s'''.decode('base64').decode('zlib') |
50 | 50 |
51 # unpack virtualenv | 51 # unpack virtualenv |
52 tempdir = tempfile.mkdtemp() | 52 tempdir = tempfile.mkdtemp() |
53 buffer = StringIO() | 53 buffer = StringIO() |
54 buffer.write(VIRTUAL_ENV) | 54 buffer.write(VIRTUAL_ENV) |
167 | 167 |
168 # interpolate "template" -> output | 168 # interpolate "template" -> output |
169 outfile = options.outfile | 169 outfile = options.outfile |
170 if outfile is None: | 170 if outfile is None: |
171 outfile = environment + '.py' | 171 outfile = environment + '.py' |
172 variables = {'VIRTUAL_ENV': VIRTUAL_ENV.encode('base64'), | 172 variables = {'VIRTUAL_ENV': VIRTUAL_ENV.encode('zlib').encode('base64'), |
173 'ENV': environment, | 173 'ENV': environment, |
174 'PACKAGE_SOURCES': source_buffer.getvalue().encode('base64')} | 174 'PACKAGE_SOURCES': source_buffer.getvalue().encode('zlib').encode('base64')} |
175 f = file(outfile, 'w') | 175 f = file(outfile, 'w') |
176 f.write(template % variables) | 176 f.write(template % variables) |
177 f.close() | 177 f.close() |
178 try: | 178 try: |
179 os.chmod(outfile, 0755) | 179 os.chmod(outfile, 0755) |