41
41
"""
42
42
43
43
import sys
44
+ import os .path
44
45
import argparse
45
46
46
47
try :
@@ -63,6 +64,10 @@ def main():
63
64
parser .add_argument ('--list-languages' , dest = 'list_languages' ,
64
65
action = 'store_true' , help = 'List all language '
65
66
'codes supported by OpenShot' )
67
+ parser .add_argument ('--path' , dest = 'py_path' ,
68
+ action = 'append' ,
69
+ help = 'Additional locations to search for modules '
70
+ '(PYTHONPATH). Can be used multiple times.' )
66
71
parser .add_argument ('-V' , '--version' , action = 'store_true' )
67
72
parser .add_argument ('remain' , nargs = argparse .REMAINDER ,
68
73
help = argparse .SUPPRESS )
@@ -81,6 +86,18 @@ def main():
81
86
print (" {:>12} {}" .format (lang [0 ],lang [1 ]))
82
87
sys .exit ()
83
88
89
+ if args .py_path :
90
+ for p in args .py_path :
91
+ try :
92
+ if os .path .exists (os .path .realpath (p )):
93
+ sys .path .insert (0 , os .path .realpath (p ))
94
+ print ("Added {} to PYTHONPATH" .format (os .path .realpath (p )))
95
+ else :
96
+ print ("{} does not exist" .format (os .path .realpath (p )))
97
+ except TypeError as ex :
98
+ print ("Bad path {}: {}" .format (p , ex ))
99
+ continue
100
+
84
101
if args .lang :
85
102
if args .lang in info .SUPPORTED_LANGUAGES :
86
103
info .CMDLINE_LANGUAGE = args .lang
0 commit comments