Skip to content

Commit 4af92dd

Browse files
author
Charles Weir
committed
Removed sortOutPythonPaths.py to make example code stand-alone
1 parent 65d703f commit 4af92dd

5 files changed

Lines changed: 11 additions & 23 deletions

File tree

ExamplePrograms/DoorControl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#
44
# Copyright (c) 2014 Charles Weir. Shared under the MIT Licence.
55

6-
import sortOutPythonPaths
6+
import sys, os # Python path kludge - omit these 2 lines if BrickPython is installed.
7+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))
8+
79
from BrickPython.TkApplication import TkApplication
810
from BrickPython.Sensor import Sensor
911
import logging

ExamplePrograms/MotorController.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#
44
# Copyright (c) 2014 Charles Weir. Shared under the MIT Licence.
55

6-
import sortOutPythonPaths
6+
import sys, os # Python path kludge - omit these 2 lines if BrickPython is installed.
7+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))
8+
79
from BrickPython.TkApplication import TkApplication
810
from BrickPython.Motor import PIDSetting
911
from BrickPython.Sensor import Sensor

ExamplePrograms/SimpleApp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
#
33
# Copyright (c) 2014 Charles Weir. Shared under the MIT Licence.
44

5-
import sortOutPythonPaths
6-
from BrickPython.CommandLineApplication import *
5+
import sys, os # Python path kludge - omit these 2 lines if BrickPython is installed.
6+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))
7+
8+
from BrickPython.CommandLineApplication import CommandLineApplication
79

810
class SimpleApp(CommandLineApplication):
911
'Simple command line example application'

ExamplePrograms/sortOutPythonPaths.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

doBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ python setup.py test
1414
echo '>> Upload docs to pypi from' `pwd`/docs/generated/Archive.zip
1515
echo '>> Form at the bottom of https://pypi.python.org/pypi?%3Aaction=pkg_edit&name=BrickPython'
1616
echo '>> To release module to pypi: python setup.py sdist upload'
17-
echo '>> To install without releasing: pip install -e .'
17+
echo '>> To install without releasing: sudo pip install -e .'

0 commit comments

Comments
 (0)