Permalink
Browse files

rundevel.py: add src to PYTHONPATH

  • Loading branch information...
1 parent cb812ae commit 3abd04ad883eca47834379e6b0a5947c30ba52a0 @pekkaklarck pekkaklarck committed Nov 9, 2015
Showing with 9 additions and 3 deletions.
  1. +9 −3 rundevel.py
View
@@ -21,6 +21,7 @@
sys.exit(__doc__)
curdir = dirname(abspath(__file__))
+src = join(curdir, 'src')
tmp = join(curdir, 'tmp')
tmp2 = join(tmp, 'rundevel')
if not exists(tmp):
@@ -30,9 +31,13 @@
os.environ['ROBOT_SYSLOG_FILE'] = join(tmp, 'syslog.txt')
os.environ['ROBOT_INTERNAL_TRACES'] = 'yes'
-os.environ['TEMPDIR'] = tmp2 # Used by tests under atest/testdata
+os.environ['TEMPDIR'] = tmp2 # Used by tests under atest/testdata
+if 'PYTHONPATH' not in os.environ: # Allow executed scripts to import robot
+ os.environ['PYTHONPATH'] = src
+else:
+ os.environ['PYTHONPATH'] = os.pathsep.join([src, os.environ['PYTHONPATH']])
-sys.path.insert(0, join(curdir, 'src'))
+sys.path.insert(0, src)
from robot import run_cli, rebot_cli
if sys.argv[1] == 'rebot':
@@ -41,7 +46,8 @@
else:
runner = run_cli
args = ['--pythonpath', join(curdir, 'atest', 'testresources', 'testlibs'),
- '--pythonpath', tmp, '--loglevel', 'DEBUG']
+ '--pythonpath', tmp,
+ '--loglevel', 'DEBUG']
args += sys.argv[2:] if sys.argv[1] == 'run' else sys.argv[1:]
runner(['--outputdir', tmp] + args)

0 comments on commit 3abd04a

Please sign in to comment.