Revision: 2425
Author: pekka.klarck
Date: Mon Feb 1 14:03:46 2010
Log: Workaround for easy_install problem with Python 2.6 fixing issue 434
and possibly also issue 236. Big thanks to rdesgroppes for providing a
patch.
http://code.google.com/p/robotframework/source/detail?r=2425
Modified:
/trunk/robot_postinstall.py
=======================================
--- /trunk/robot_postinstall.py Sat Apr 4 01:19:53 2009
+++ /trunk/robot_postinstall.py Mon Feb 1 14:03:46 2010
@@ -16,7 +16,7 @@
version = os.path.basename(temp_robot_path)
version = version.replace('-', '_').replace('_', '-', 1)
egg_name = '%s-py%s.%s.egg' % (version, major, minor)
- robot_dir = os.path.join(get_python_lib(), egg_name, 'robot')
+ robot_dir = os.path.join(_find_easy_install_dir() or get_python_lib(),
egg_name, 'robot')
_update_scripts(scripts, temp_robot_path, robot_dir)
@@ -67,6 +67,31 @@
print "Failed to remove Jython compiled file '%s': %s"
\
% (path, str(err))
+def _find_easy_install_dir():
+ """Returns the installation directory that easy_install will actually
use.
+
+ This is a workaround because:
+ 1. distutils.sysconfig.get_python_lib() is not aware of easy_install
+ way of managing installation paths.
+ 2. easy_install doesn't pass its install_dir as a command line argument
+ to the setup script.
+ """
+ try:
+ import inspect
+ f = inspect.currentframe()
+ try:
+ while True:
+ if f is None:
+ return
+ instance = f.f_locals.get("self")
+ if instance and hasattr(instance, "install_dir"):
+ return getattr(instance, "install_dir")
+ f = f.f_back
+ finally:
+ del f
+ except Exception, err:
+ print "Failed to retrieve easy_install_dir: %s" % str(err)
+
def _get_installation_dir():
"""Returns installation location. Works also with easy_install."""
try: