Skip to content

Commit 9413975

Browse files
committed
launch.py: Add a --path arg to set PYTHONPATH
1 parent 1ec4d24 commit 9413975

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

src/launch.py

+28-11
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
11
#!/usr/bin/env python3
22

3-
"""
3+
"""
44
@file
55
@brief This file is used to launch OpenShot
66
@author Jonathan Thomas <[email protected]>
77
@author Noah Figg <[email protected]>
8-
8+
99
@mainpage OpenShot Video Editor 2.0
10-
10+
1111
Welcome to the OpenShot Video Editor 2.0 PyQt5 documentation. OpenShot was developed to
1212
make high-quality video editing and animation solutions freely available to the world. With a focus
1313
on stability, performance, and ease-of-use, we believe OpenShot is the best cross-platform,
1414
open-source video editing application in the world!
15-
16-
This documentation is auto-generated by Doxygen, using the doxypy Python filter. If you are
17-
interested in how OpenShot Video Editor is designed, feel free to dive in, because this
15+
16+
This documentation is auto-generated by Doxygen, using the doxypy Python filter. If you are
17+
interested in how OpenShot Video Editor is designed, feel free to dive in, because this
1818
documentation was built just for you. If you are not a developer, please feel free to visit
19-
our main website (http://www.openshot.org/download/), and download a copy today for Linux, Mac, or Windows.
19+
our main website (http://www.openshot.org/download/), and download a copy today for Linux, Mac, or Windows.
2020
2121
@section LICENSE
22-
22+
2323
Copyright (c) 2008-2018 OpenShot Studios, LLC
2424
(http://www.openshotstudios.com). This file is part of
2525
OpenShot Video Editor (http://www.openshot.org), an open-source project
2626
dedicated to delivering high quality video editing and animation solutions
2727
to the world.
28-
28+
2929
OpenShot Video Editor is free software: you can redistribute it and/or modify
3030
it under the terms of the GNU General Public License as published by
3131
the Free Software Foundation, either version 3 of the License, or
3232
(at your option) any later version.
33-
33+
3434
OpenShot Video Editor is distributed in the hope that it will be useful,
3535
but WITHOUT ANY WARRANTY; without even the implied warranty of
3636
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3737
GNU General Public License for more details.
38-
38+
3939
You should have received a copy of the GNU General Public License
4040
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
4141
"""
4242

4343
import sys
44+
import os.path
4445
from argparse import ArgumentParser, REMAINDER
4546

4647
try:
@@ -65,6 +66,10 @@ def main():
6566
parser.add_argument('--list-languages', dest='list_languages',
6667
action='store_true', help='List all language '
6768
'codes supported by OpenShot')
69+
parser.add_argument('--path', dest='py_path',
70+
action='append',
71+
help='Additional locations to search for modules '
72+
'(PYTHONPATH). Can be used multiple times.')
6873
parser.add_argument('-V', '--version', action='store_true')
6974
parser.add_argument('remain', nargs=REMAINDER)
7075

@@ -82,6 +87,18 @@ def main():
8287
print(" {:>12} {}".format(lang[0],lang[1]))
8388
sys.exit()
8489

90+
if args.py_path:
91+
for p in args.py_path:
92+
try:
93+
if os.path.exists(os.path.realpath(p)):
94+
sys.path.insert(0, os.path.realpath(p))
95+
print("Added {} to PYTHONPATH".format(os.path.realpath(p)))
96+
else:
97+
print("{} does not exist".format(os.path.realpath(p)))
98+
except TypeError as ex:
99+
print("Bad path {}: {}".format(p, ex))
100+
continue
101+
85102
if args.lang:
86103
if args.lang in info.SUPPORTED_LANGUAGES:
87104
info.CMDLINE_LANGUAGE = args.lang

0 commit comments

Comments
 (0)