proposed change to mkvirtenv.py

0 views
Skip to first unread message

BJ Dierkes

unread,
Jul 2, 2010, 3:16:41 PM7/2/10
to hollan...@googlegroups.com
Does anyone have a problem with this change to not use site_packages (from the host)? Its causing a bit of issues where deps aren't installed to the virtualenv because they are provided by the host system's site_packages... but holland itself when run can't import them.

I proposed setting site_packages=False:


diff --git a/scripts/mkvirtenv.py b/scripts/mkvirtenv.py
index a6e7c48..406d0d9 100755
--- a/scripts/mkvirtenv.py
+++ b/scripts/mkvirtenv.py
@@ -170,7 +170,7 @@ def main(args=None):
logging.error("Please exit your current virtual environment before trying to create another
return 1

- create_environment(home_dir, site_packages=True, clear=opts.clear,
+ create_environment(home_dir, site_packages=False, clear=opts.clear,
unzip_setuptools=False, use_distribute=opts.distribute)
virtualenv = make_env(home_dir)
egg_env = find_egg_env(os.path.join(home_dir, 'lib', 'python2.4', 'site-packages'))

Any issues with that?

---
BJ Dierkes
Linux Systems Engineer IV / [RH]acker
Infrastructure Services [Development]
Rackspace Hosting

Andy Garner

unread,
Jul 2, 2010, 3:30:47 PM7/2/10
to hollan...@googlegroups.com
I think I asked the same thing a while back. What dependency is failing from site-packages? I think I toggled this a long time ago when I was running into slow and/or failing mysqldb builds in certain test environments where there was already a usable mysqldb dist. Maybe we can make it a cli opt w/ a default to not use site-packages.

Andy
--
WIKI: http://wiki.hollandbackup.org
CODE: http://github.com/holland-backup
UNSUBSCRIBE: holland-deve...@googlegroups.com


Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at ab...@rackspace.com, and delete the original message.
Your cooperation is appreciated.

BJ Dierkes

unread,
Jul 2, 2010, 3:49:27 PM7/2/10
to hollan...@googlegroups.com
Right on... How about this (which keeps current functionality the same)?

diff --git a/scripts/mkvirtenv.py b/scripts/mkvirtenv.py
index a6e7c48..8ddce1b 100755
--- a/scripts/mkvirtenv.py
+++ b/scripts/mkvirtenv.py
@@ -161,16 +161,25 @@ def main(args=None):
default=False,
help='Clear out the non-root install and start '
'from scratch')
+ oparser.add_option('--no-site-packages', action='store_true',
+ default=False, dest='no_site_packages',
+ help='Use the systems site_packages')
oparser.add_option('--debug', action='store_true')
opts, args = oparser.parse_args(args)

+ # this seems odd, but we want the oposite logic of no-site-packages
+ if opts.no_site_packages:
+ use_site_packages = False
+ else:
+ use_site_packages = True
+
setup_logging(opts.debug)
home_dir = os.environ.get('HOLLAND_HOME', expanduser('~/holland-test'))
if home_dir in sys.executable:


logging.error("Please exit your current virtual environment before trying to create another
return 1

- create_environment(home_dir, site_packages=True, clear=opts.clear,

+ create_environment(home_dir, site_packages=use_site_packages, clear=opts.clear,


unzip_setuptools=False, use_distribute=opts.distribute)
virtualenv = make_env(home_dir)
egg_env = find_egg_env(os.path.join(home_dir, 'lib', 'python2.4', 'site-packages'))


---
derks

Reply all
Reply to author
Forward
0 new messages