2 new revisions:
Revision: 1b3fd5479c05
Author: Pekka Klärck
Date: Fri Jan 13 06:02:08 2012
Log: pythonpathsetter cleanup...
http://code.google.com/p/robotframework/source/detail?r=1b3fd5479c05
Revision: 5b3691b55426
Author: Pekka Klärck
Date: Fri Jan 13 06:02:20 2012
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=5b3691b55426
==============================================================================
Revision: 1b3fd5479c05
Author: Pekka Klärck
Date: Fri Jan 13 06:02:08 2012
Log: pythonpathsetter cleanup
removed lot of old cruft related to jython 2.2 and old installation system
Update issue 1034
Status: started
PYTHONPATH is processed anymore.
Still need to check does User Guide say something about this.
http://code.google.com/p/robotframework/source/detail?r=1b3fd5479c05
Modified:
/src/robot/pythonpathsetter.py
=======================================
--- /src/robot/pythonpathsetter.py Sun Feb 6 01:24:10 2011
+++ /src/robot/pythonpathsetter.py Fri Jan 13 06:02:08 2012
@@ -12,63 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
"""Module that adds directories needed by Robot to sys.path when
imported."""
import sys
-import os
import fnmatch
-
-
-def add_path(path, to_beginning=False, force=False):
- if _should_be_added(path, force):
- if to_beginning:
- sys.path.insert(0, path)
- else:
- sys.path.append(path)
+from os.path import abspath, dirname, join
+
+ROBOTDIR = dirname(abspath(__file__))
+PARENTDIR = dirname(ROBOTDIR)
+
+def add_path(path, end=False):
+ if not end:
+ sys.path.insert(0, path)
+ else:
+ sys.path.append(path)
def remove_path(path):
- path = _normpath(path)
- sys.path = [p for p in sys.path if _normpath(p) != path]
-
-def _should_be_added(path, force):
- if (not path) or _find_in_syspath_normalized(path):
- return False
- return force or os.path.exists(path)
-
-def _find_in_syspath_normalized(path):
- path = _normpath(path)
- for element in sys.path:
- if _normpath(element) == path:
- return element
- return None
-
-def _normpath(path):
- return os.path.normcase(os.path.normpath(path))
-
-
-ROBOTDIR = os.path.dirname(os.path.abspath(__file__))
-PARENTDIR = os.path.dirname(ROBOTDIR)
-
-add_path(os.path.join(ROBOTDIR, 'libraries'), to_beginning=True,
- force=True)
-add_path(PARENTDIR, to_beginning=True)
-# Handles egg installations
-if
fnmatch.fnmatchcase(os.path.basename(PARENTDIR), 'robotframework-*.egg'):
- add_path(os.path.dirname(PARENTDIR), to_beginning=True)
-
-# Remove ROBOTDIR dir to disallow importing robot internal modules directly
-remove_path(ROBOTDIR)
-
-# Elements from PYTHONPATH. By default it is not processed in Jython and in
-# Python valid non-absolute paths may be ignored.
-PYPATH = os.environ.get('PYTHONPATH')
-if PYPATH:
- for path in PYPATH.split(os.pathsep):
- add_path(path)
- del path
-
-# Current dir (it seems to be in Jython by default so let's be consistent)
-add_path('.')
-
-del _find_in_syspath_normalized, _normpath, add_path, remove_path,
ROBOTDIR, PARENTDIR, PYPATH
+ sys.path = [p for p in sys.path if not fnmatch.fnmatch(p, path)]
+
+
+add_path(PARENTDIR)
+add_path(join(ROBOTDIR, 'libraries'))
+add_path('.', end=True) # Jython adds this automatically so let's be
consistent
+remove_path(ROBOTDIR) # Prevent importing internal modules directly
==============================================================================
Revision: 5b3691b55426
Author: Pekka Klärck
Date: Fri Jan 13 06:02:20 2012
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=5b3691b55426