# HG changeset patch # User Jeff Hammel # Date 1310348910 25200 # Node ID dace84448c2542df3c20f038b8b754f39e985769 # Parent e6ee0410ceef8daf0eeed6234e1867079494f35f carry carton along with carton diff -r e6ee0410ceef -r dace84448c25 carton.py --- a/carton.py Sun Jul 10 18:37:42 2011 -0700 +++ b/carton.py Sun Jul 10 18:48:30 2011 -0700 @@ -123,22 +123,21 @@ if os.path.exists(os.path.join(virtualenv_dir, 'setup.py')): call([python, 'setup.py', 'install'], cwd=virtualenv_dir, stdout=subprocess.PIPE) -# TODO: -# - add carton to the virtualenv (!) -# if CARTON: -# CARTON = CARTON.decode('base64').decode('zlib') -# carton_filename = os.path.join(scripts_dir, 'carton.py') -# f = file(carton_filename, 'w') -# f.write(CARTON) -# f.close() -# try: -# os.chmod(carton_filename, 0755) -# except: -# # you probably don't have os.chmod -# pass +# add carton to the virtualenv (!) +if CARTON: + CARTON = CARTON.decode('base64').decode('zlib') + carton_filename = os.path.join(scripts_dir, 'carton.py') + f = file(carton_filename, 'w') + f.write(CARTON) + f.close() + try: + os.chmod(carton_filename, 0755) + except: + # you probably don't have os.chmod + pass -# - cleanup tempdir +# TODO: cleanup tempdir # shutil.rmtree(tempdir) """ diff -r e6ee0410ceef -r dace84448c25 tests/doctest.txt --- a/tests/doctest.txt Sun Jul 10 18:37:42 2011 -0700 +++ b/tests/doctest.txt Sun Jul 10 18:48:30 2011 -0700 @@ -44,6 +44,17 @@ >>> os.path.exists(os.path.join(bin, 'virtualenv')) or os.path.exists(os.path.join(bin, 'virtualenv.exe')) True +Ensure you're bringing along carton:: + + >>> packaged_carton = os.path.join(bin, 'carton.py') + >>> os.path.exists(packaged_carton) + True + >>> carton_module = carton.__file__.rstrip('c') + >>> os.path.exists(carton_module) + True + >>> file(packaged_carton).read() == file(carton_module).read() + True + Show that non-package files get carried along too:: >>> os.path.exists(os.path.join('foo', 'src', 'packageA', 'foo.txt'))