Skip to content

Commit 2e6cfa9

Browse files
committed
tidy up pluginpy config
1 parent 8940199 commit 2e6cfa9

File tree

4 files changed

+35
-108
lines changed

4 files changed

+35
-108
lines changed

src/pluginpy/PluginPy.vcxproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ exit 0</Command>
187187
copy /y $(OutputPath)$(TargetFileName) $(OutputPath)python\launchy.pyd
188188
echo "copying target to launchy.pyd"
189189
copy /y launchy_util.py $(OutputPath)python\launchy_util.py
190-
echo "copying launchy_util.py"
191-
copy /y launchy_test.py $(OutputPath)python\launchy_test.py
192-
echo "copying launchy_test.py"</Command>
190+
echo "copying launchy_util.py"</Command>
193191
<Message>
194192
</Message>
195193
</PostBuildEvent>

src/pluginpy/launchy_test.py

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

src/pluginpy/launchy_util.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,44 @@ def setSettingsObject():
5252
print("launchy_util, setSettingsObject, Exception,", err)
5353

5454

55-
def loadPluginConf():
55+
def initPipPackage():
56+
import sys, os
57+
print("launchy_util, initPipPackage, sys.prefix:", sys.prefix)
58+
59+
xlib = os.path.join(sys.prefix, 'Lib')
60+
61+
if os.path.exists(xlib):
62+
print("launchy_util, initPipPackage, Lib path found, init site")
63+
sys.path.insert(0, xlib)
64+
sys.path.insert(0, sys.prefix)
65+
sys.path.insert(0, ".")
66+
67+
path = os.environ.get('PATH', '')
68+
#print ("env.path(origin):", path)
69+
os.environ['PATH'] = path + os.pathsep + sys.prefix + os.pathsep
70+
71+
#print("launchy_util, initPipPackage, sys.path:", sys.path)
72+
#print("launchy_util, initPipPackage, env.path:", os.environ.get('PATH', ''))
73+
74+
import site
75+
site.main()
76+
os.chdir(sys.prefix)
77+
else:
78+
print("launchy_util, initPipPackage, Lib path not found, skip init site")
79+
80+
def loadPyConf():
5681
try:
57-
from pluginconf import loadConf
58-
loadConf()
82+
print("launchy_util, loadPyConf, begin")
83+
import launchy_pyconf
84+
print("launchy_util, loadPyConf, end")
5985
except Exception as err:
60-
print("launchy_util, loadPluginconf,", err)
61-
86+
print("launchy_util, loadPyConf, catched exception:", err)
6287

63-
def launchy_util():
88+
try:
6489
redirectOutput()
65-
loadPluginConf()
90+
initPipPackage()
91+
#loadPyConf()
6692
print("launchy_util, sys.path:", sys.path)
6793
print("launchy_util, env.path:", os.environ.get('PATH', ''))
68-
69-
try:
70-
launchy_util()
7194
except Exception as err:
72-
print("launchy_util,", err)
95+
print("launchy_util, catched exception", err)

src/pluginpy/pluginconf.py

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

0 commit comments

Comments
 (0)