Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-20 22:26:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-20 22:26:23 +0300
commit0568f608c400cc2a0f88c65ef1eb55126d945887 (patch)
treea3bee8d0112f17866a5ba73fc1986e6e50428b41 /release/scripts/modules/bpy/__init__.py
parent9857ffde31725b085d24a09f1bbfe7ae1bb839d8 (diff)
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.
Diffstat (limited to 'release/scripts/modules/bpy/__init__.py')
-rw-r--r--release/scripts/modules/bpy/__init__.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 28f082c9bd1..fb0bdd2fa1e 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -34,8 +34,8 @@ from bpy import ops as _ops_module
# 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 @@ def load_scripts(reload_scripts=False):
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 load_scripts(reload_scripts=False):
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: