FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
winpython/winpython/config.py at master · sofibox/winpython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
sofibox
/
winpython
Public
forked from
winpython/winpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
winpython
/
winpython
/
config.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (39 loc) · 1.38 KB
Breadcrumbs
winpython
/
winpython
/
config.py
Copy path
File metadata and controls
48 lines (39 loc) · 1.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see winpython/__init__.py for details)
"""
WinPython utilities configuration
Created on Wed Aug 29 12:23:19 2012
"""
import
sys
from
pathlib
import
Path
def
get_module_path
(
modname
):
"""Return module *modname* base path"""
return
str
(
Path
(
sys
.
modules
[
modname
].
__file__
).
parent
.
resolve
())
def
get_module_data_path
(
modname
,
relpath
=
None
,
attr_name
=
'DATAPATH'
):
"""Return module *modname* data path
Note: relpath is ignored if module has an attribute named *attr_name*
Handles py2exe/cx_Freeze distributions"""
datapath
=
getattr
(
sys
.
modules
[
modname
],
attr_name
,
''
)
if
datapath
:
return
datapath
else
:
datapath
=
get_module_path
(
modname
)
parentdir
=
str
(
Path
(
datapath
).
parent
)
if
Path
(
parentdir
).
is_file
():
# Parent directory is not a directory but the 'library.zip' file:
# this is either a py2exe or a cx_Freeze distribution
datapath
=
str
((
Path
(
parentdir
).
parent
/
modname
).
resolve
())
if
relpath
is
not
None
:
datapath
=
str
((
Path
(
datapath
)
/
relpath
).
resolve
())
return
datapath
DATA_PATH
=
get_module_data_path
(
'winpython'
,
relpath
=
'data'
)
IMAGE_PATH
=
get_module_data_path
(
'winpython'
,
relpath
=
'images'
)
Back
|
FazBrowse Home
|
New Git URL