Skip to content

Commit 586d16b

Browse files
committed
remove osp from config.py
1 parent af1bed7 commit 586d16b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

winpython/config.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
"""
1212

1313
import sys
14-
import os.path as osp
14+
# import os.path as osp
1515
from pathlib import Path
1616

1717
def get_module_path(modname):
1818
"""Return module *modname* base path"""
19-
return osp.abspath(
20-
osp.dirname(sys.modules[modname].__file__)
21-
)
19+
#return osp.abspath(
20+
# osp.dirname(sys.modules[modname].__file__)
21+
#)
22+
return str(Path(sys.modules[modname].__file__).parent.resolve())
2223

2324

2425
def get_module_data_path(
@@ -35,20 +36,21 @@ def get_module_data_path(
3536
datapath = get_module_path(modname)
3637
# parentdir = osp.join(datapath, osp.pardir)
3738
parentdir = str(Path(datapath).parent)
38-
if osp.isfile(parentdir):
39+
#if osp.isfile(parentdir):
40+
if Path(parentdir).is_file():
3941
# Parent directory is not a directory but the 'library.zip' file:
4042
# this is either a py2exe or a cx_Freeze distribution
41-
datapath = osp.abspath(
43+
#datapath = osp.abspath(
4244
# osp.join(
4345
# osp.join(parentdir, osp.pardir), modname
4446
# )
45-
str(Path(parentdir).parent / modname)
46-
)
47+
#)
48+
datapath = str((Path(parentdir).parent / modname).resolve())
4749
if relpath is not None:
48-
datapath = osp.abspath(
50+
#datapath = osp.abspath(
4951
# osp.join(datapath, relpath)
50-
str(Path(datapath) / relpath)
51-
)
52+
#)
53+
datapath = str((Path(datapath) / relpath).resolve())
5254
return datapath
5355

5456

0 commit comments

Comments
 (0)