config2py 0.1.33__tar.gz → 0.1.34__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {config2py-0.1.33 → config2py-0.1.34}/PKG-INFO +1 -1
- {config2py-0.1.33 → config2py-0.1.34}/config2py/tools.py +2 -2
- {config2py-0.1.33 → config2py-0.1.34}/config2py/util.py +11 -2
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/PKG-INFO +1 -1
- {config2py-0.1.33 → config2py-0.1.34}/setup.cfg +1 -1
- {config2py-0.1.33 → config2py-0.1.34}/LICENSE +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/README.md +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/__init__.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/base.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/errors.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/s_configparser.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/scrap/__init__.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/tests/__init__.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/tests/test_tools.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py/tests/util.py +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/SOURCES.txt +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/dependency_links.txt +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/not-zip-safe +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/requires.txt +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/config2py.egg-info/top_level.txt +0 -0
- {config2py-0.1.33 → config2py-0.1.34}/setup.py +0 -0
|
@@ -27,7 +27,7 @@ def get_configs_local_store(
|
|
|
27
27
|
If it's a file, it's assumed to be an ini or cfg file.
|
|
28
28
|
If it's a string, it's assumed to be an app name, from which to create a folder
|
|
29
29
|
"""
|
|
30
|
-
if os.path.isdir(config_src):
|
|
30
|
+
if os.path.sep in config_src and os.path.isdir(config_src):
|
|
31
31
|
# TODO: This was a quick fix to avoid unknowingly making directories in the
|
|
32
32
|
# wrong place. Broke stuff so leaving this for later.
|
|
33
33
|
# if os.path.sep not in config_src:
|
|
@@ -76,7 +76,7 @@ def simple_config_getter(
|
|
|
76
76
|
default) asks the user for the value and stores it in the central config store.
|
|
77
77
|
|
|
78
78
|
:param configs_src: A specification of the central config store. By default:
|
|
79
|
-
If it's a directory, it's assumed to be a folder of text files.
|
|
79
|
+
If it's a directory (with at least a slash), it's assumed to be a folder of text files.
|
|
80
80
|
If it's a file, it's assumed to be an ini or cfg file.
|
|
81
81
|
If it's a string, it's assumed to be an app name, from which to create a folder
|
|
82
82
|
:param first_look_in_env_vars: Whether to look in environment variables first
|
|
@@ -182,6 +182,8 @@ def process_path(
|
|
|
182
182
|
ensure_endswith_slash=False,
|
|
183
183
|
ensure_does_not_end_with_slash=False,
|
|
184
184
|
expanduser=True,
|
|
185
|
+
expandvars=True,
|
|
186
|
+
abspath=True,
|
|
185
187
|
rootdir: str = '',
|
|
186
188
|
) -> str:
|
|
187
189
|
"""
|
|
@@ -194,12 +196,15 @@ def process_path(
|
|
|
194
196
|
ensure_endswith_slash (bool): Whether to ensure the path ends with a slash.
|
|
195
197
|
ensure_does_not_end_with_slash (bool): Whether to ensure the path does not end with a slash.
|
|
196
198
|
expanduser (bool): Whether to expand the user in the path.
|
|
199
|
+
expandvars (bool): Whether to expand environment variables in the path.
|
|
200
|
+
abspath (bool): Whether to convert the path to an absolute path.
|
|
201
|
+
rootdir (str): The root directory to prepend to the path.
|
|
197
202
|
|
|
198
203
|
Returns:
|
|
199
204
|
str: The processed path.
|
|
200
205
|
|
|
201
|
-
>>> process_path('a', 'b', 'c')
|
|
202
|
-
'a/b/c'
|
|
206
|
+
>>> process_path('a', 'b', 'c') # doctest: +ELLIPSIS
|
|
207
|
+
'...a/b/c'
|
|
203
208
|
>>> from functools import partial
|
|
204
209
|
>>> process_path('a', 'b', 'c', rootdir='/root/dir/', ensure_endswith_slash=True)
|
|
205
210
|
'/root/dir/a/b/c/'
|
|
@@ -214,6 +219,10 @@ def process_path(
|
|
|
214
219
|
path = os.path.join(rootdir, path)
|
|
215
220
|
if expanduser:
|
|
216
221
|
path = os.path.expanduser(path)
|
|
222
|
+
if expandvars:
|
|
223
|
+
path = os.path.expandvars(path)
|
|
224
|
+
if abspath:
|
|
225
|
+
path = os.path.abspath(path)
|
|
217
226
|
if ensure_endswith_slash:
|
|
218
227
|
if not path.endswith('/'):
|
|
219
228
|
path = path + '/'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|