[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26150] trunk/blender/release/scripts/ modules/bpy/__init__.py: Patch from Jochen Schmitt, (various distro' s had patched this)
Campbell Barton
ideasman42 at gmail.com
Wed Jan 20 20:26:25 CET 2010
Revision: 26150
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26150
Author: campbellbarton
Date: 2010-01-20 20:26:23 +0100 (Wed, 20 Jan 2010)
Log Message:
-----------
Patch from Jochen Schmitt, (various distro's had patched this)
- modify the path in python rather then C
- filter returns an object in python 3, set using slice.
also import sys as _sys so it doesnt appier in aytocompleation.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy/__init__.py
Modified: trunk/blender/release/scripts/modules/bpy/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/__init__.py 2010-01-20 19:20:07 UTC (rev 26149)
+++ trunk/blender/release/scripts/modules/bpy/__init__.py 2010-01-20 19:26:23 UTC (rev 26150)
@@ -34,8 +34,8 @@
# fake operator module
ops = _ops_module.ops_fake_module
-import sys
-DEBUG = ("-d" in sys.argv)
+import sys as _sys
+DEBUG = ("-d" in _sys.argv)
def load_scripts(reload_scripts=False):
@@ -76,14 +76,14 @@
for module_name in loaded_modules:
print("Reloading:", module_name)
- reload(sys.modules[module_name])
+ reload(_sys.modules[module_name])
for base_path in utils.script_paths():
for path_subdir in ("ui", "op", "io"):
path = os.path.join(base_path, path_subdir)
if os.path.isdir(path):
- if path not in sys.path: # reloading would add twice
- sys.path.insert(0, path)
+ if path not in _sys.path: # reloading would add twice
+ _sys.path.insert(0, path)
for f in sorted(os.listdir(path)):
if f.endswith(".py"):
# python module
@@ -104,10 +104,13 @@
def _main():
+ # security issue, dont allow the $CWD in the path.
+ _sys.path[:] = filter(None, _sys.path)
+
# a bit nasty but this prevents help() and input() from locking blender
# Ideally we could have some way for the console to replace sys.stdin but
# python would lock blender while waiting for a return value, not easy :|
- sys.stdin = None
+ _sys.stdin = None
# if "-d" in sys.argv: # Enable this to measure startup speed
if 0:
More information about the Bf-blender-cvs
mailing list