Universal pathmagic returns app dir; activated in setup for python3
This commit is contained in:
parent
f8844f4d74
commit
d05255625b
3
setup.py
3
setup.py
|
@ -48,6 +48,9 @@ class InstallCmd(install):
|
||||||
|
|
||||||
def unittest_discover():
|
def unittest_discover():
|
||||||
"""Explicit test suite creation"""
|
"""Explicit test suite creation"""
|
||||||
|
if sys.hexversion >= 0x3000000:
|
||||||
|
from pybitmessage import pathmagic
|
||||||
|
pathmagic.setup()
|
||||||
return unittest.TestLoader().discover('pybitmessage.tests')
|
return unittest.TestLoader().discover('pybitmessage.tests')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,11 @@ The PyBitmessage startup script
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
try:
|
||||||
os.chdir(app_dir)
|
import pathmagic
|
||||||
sys.path.insert(0, app_dir)
|
except ImportError:
|
||||||
|
from pybitmessage import pathmagic
|
||||||
|
app_dir = pathmagic.setup()
|
||||||
|
|
||||||
import depends
|
import depends
|
||||||
depends.check_dependencies()
|
depends.check_dependencies()
|
||||||
|
|
10
src/pathmagic.py
Normal file
10
src/pathmagic.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
"""Add path to this file to sys.path"""
|
||||||
|
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
os.chdir(app_dir)
|
||||||
|
sys.path.insert(0, app_dir)
|
||||||
|
return app_dir
|
Reference in New Issue
Block a user