Skip to content

Commit 376aeff

Browse files
committed
adjust sys.path in runYourProgram
1 parent 33efdfc commit 376aeff

4 files changed

Lines changed: 6 additions & 26 deletions

File tree

python/README.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,3 @@ This needs Python 3.12.x. After installation, you can use the `wypp` command
2626
for running your python files, making all features explained below available.
2727
Run `wypp --help` for usage information.
2828

29-
## Development
30-
31-
### Debugging
32-
33-
To debug a failing unit test, insert the following at top of the file (adjust path as needed):
34-
35-
```
36-
import sys
37-
sys.path.insert(0, '/Users/swehr/devel/write-your-python-program/python/deps/untypy')
38-
```
39-
40-
Then insert at the end of the file:
41-
42-
```
43-
def _debug():
44-
t = TestSimple()
45-
t.setUp()
46-
t.test_wrap_inheritance()
47-
_debug()
48-
```
49-
50-
Then debug in vscode

python/code/wypp/runYourProgram.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
sys.exit(1)
1414

1515
if __name__ == '__main__':
16+
import os
17+
sourceDir = os.path.normpath(os.path.dirname(__file__))
18+
codeDir = os.path.abspath(os.path.dirname(sourceDir))
19+
if codeDir not in sys.path:
20+
sys.path.insert(0, codeDir)
1621
import wypp.runner as r
1722
r.main(globals())

python/code/wypp/runner.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
22
import sys
33

4-
from . import constants
5-
sys.path.insert(0, constants.CODE_DIR)
6-
74
requiredVersion = (3, 12, 0)
85
def pythonVersionOk(v):
96
(reqMajor, reqMinor, reqMicro) = requiredVersion

python/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ OPTS="--quiet"
1111
# For profiling, uncomment the line below
1212
# PROF="-m cProfile -o profile.out"
1313

14-
PYTHONPATH="$SCRIPT_DIR"/code:"$PYTHONPATH" $PY $PROF "$SCRIPT_DIR"/code/wypp/runYourProgram.py \
14+
$PY $PROF "$SCRIPT_DIR"/code/wypp/runYourProgram.py \
1515
--no-clear $OPTS "$@"
1616
exit $?

0 commit comments

Comments
 (0)