envstack 0.7.3__tar.gz → 0.7.4__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.
- {envstack-0.7.3/lib/envstack.egg-info → envstack-0.7.4}/PKG-INFO +1 -1
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/__init__.py +1 -1
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/cli.py +1 -8
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/env.py +5 -3
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/util.py +5 -7
- {envstack-0.7.3 → envstack-0.7.4/lib/envstack.egg-info}/PKG-INFO +1 -1
- {envstack-0.7.3 → envstack-0.7.4}/setup.py +1 -1
- {envstack-0.7.3 → envstack-0.7.4}/tests/test_env.py +20 -0
- {envstack-0.7.3 → envstack-0.7.4}/LICENSE +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/README.md +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/dist.json +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/config.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/exceptions.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/logger.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/path.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack/wrapper.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/SOURCES.txt +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/dependency_links.txt +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/entry_points.txt +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/not-zip-safe +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/requires.txt +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/lib/envstack.egg-info/top_level.txt +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/setup.cfg +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/tests/test_cmds.py +0 -0
- {envstack-0.7.3 → envstack-0.7.4}/tests/test_util.py +0 -0
|
@@ -38,14 +38,7 @@ import sys
|
|
|
38
38
|
import traceback
|
|
39
39
|
|
|
40
40
|
from envstack import __version__, config
|
|
41
|
-
from envstack.env import
|
|
42
|
-
clear,
|
|
43
|
-
export,
|
|
44
|
-
get_sources,
|
|
45
|
-
load_environ,
|
|
46
|
-
resolve_environ,
|
|
47
|
-
trace_var,
|
|
48
|
-
)
|
|
41
|
+
from envstack.env import clear, export, load_environ, resolve_environ, trace_var
|
|
49
42
|
from envstack.wrapper import run_command
|
|
50
43
|
|
|
51
44
|
|
|
@@ -38,6 +38,8 @@ import re
|
|
|
38
38
|
import string
|
|
39
39
|
from pathlib import Path
|
|
40
40
|
|
|
41
|
+
import yaml # noqa
|
|
42
|
+
|
|
41
43
|
from envstack import config, logger, path, util
|
|
42
44
|
from envstack.exceptions import *
|
|
43
45
|
|
|
@@ -605,14 +607,14 @@ def init(*name, ignore_missing: bool = config.IGNORE_MISSING):
|
|
|
605
607
|
# save environment to restore later using envstack.revert()
|
|
606
608
|
save()
|
|
607
609
|
|
|
608
|
-
# clear old sys.path values
|
|
610
|
+
# clear old sys.path values from PYTHONPATH
|
|
609
611
|
util.clear_sys_path()
|
|
610
612
|
|
|
611
613
|
# load the stack and update the environment
|
|
612
614
|
env = resolve_environ(load_environ(name, ignore_missing=ignore_missing))
|
|
613
615
|
os.environ.update(util.encode(env))
|
|
614
616
|
|
|
615
|
-
# update sys.path from PYTHONPATH
|
|
617
|
+
# update sys.path from resolved PYTHONPATH
|
|
616
618
|
util.load_sys_path()
|
|
617
619
|
|
|
618
620
|
|
|
@@ -665,7 +667,7 @@ def load_environ(
|
|
|
665
667
|
name = [config.DEFAULT_NAMESPACE]
|
|
666
668
|
|
|
667
669
|
# TODO: do we need to add a revert here?
|
|
668
|
-
#revert()
|
|
670
|
+
# revert()
|
|
669
671
|
|
|
670
672
|
# create the environment to be returned
|
|
671
673
|
env = Env()
|
|
@@ -33,13 +33,17 @@ __doc__ = """
|
|
|
33
33
|
Contains common utility functions and classes.
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
+
import glob
|
|
36
37
|
import os
|
|
37
38
|
import re
|
|
38
39
|
import sys
|
|
40
|
+
from ast import literal_eval
|
|
41
|
+
from collections import OrderedDict
|
|
42
|
+
|
|
43
|
+
import yaml
|
|
39
44
|
|
|
40
45
|
from envstack import config
|
|
41
46
|
from envstack.exceptions import CyclicalReference
|
|
42
|
-
from collections import OrderedDict
|
|
43
47
|
|
|
44
48
|
# value for unresolvable variables
|
|
45
49
|
null = ""
|
|
@@ -287,8 +291,6 @@ def safe_eval(value: str):
|
|
|
287
291
|
:returns: evaluated value.
|
|
288
292
|
"""
|
|
289
293
|
try:
|
|
290
|
-
from ast import literal_eval
|
|
291
|
-
|
|
292
294
|
eval_func = literal_eval
|
|
293
295
|
except ImportError:
|
|
294
296
|
# warning: security issue
|
|
@@ -310,8 +312,6 @@ def get_stacks():
|
|
|
310
312
|
"""
|
|
311
313
|
Returns a list of all stack names found in the environment paths.
|
|
312
314
|
"""
|
|
313
|
-
import glob
|
|
314
|
-
|
|
315
315
|
paths = get_paths_from_var("ENVPATH")
|
|
316
316
|
stacks = set()
|
|
317
317
|
|
|
@@ -374,8 +374,6 @@ def validate_yaml(file_path: str):
|
|
|
374
374
|
|
|
375
375
|
:param file_path: Path to the YAML file to validate.
|
|
376
376
|
"""
|
|
377
|
-
import yaml
|
|
378
|
-
|
|
379
377
|
required_keys = {"all", "darwin", "linux", "windows"}
|
|
380
378
|
|
|
381
379
|
try:
|
|
@@ -40,7 +40,7 @@ with open(os.path.join(here, "README.md")) as f:
|
|
|
40
40
|
|
|
41
41
|
setup(
|
|
42
42
|
name="envstack",
|
|
43
|
-
version="0.7.
|
|
43
|
+
version="0.7.4",
|
|
44
44
|
description="Stacked environment variable management system",
|
|
45
45
|
long_description=long_description,
|
|
46
46
|
long_description_content_type="text/markdown",
|
|
@@ -338,6 +338,26 @@ class TestIssues(unittest.TestCase):
|
|
|
338
338
|
]
|
|
339
339
|
self.assertEqual(paths, expected_paths)
|
|
340
340
|
|
|
341
|
+
def test_issue_36(self):
|
|
342
|
+
"""Tests issue #36 with init and yaml import."""
|
|
343
|
+
envpath = os.path.join(os.path.dirname(__file__), "..", "env")
|
|
344
|
+
os.environ["ENVPATH"] = envpath
|
|
345
|
+
|
|
346
|
+
# clear sys path to simulate no yaml module
|
|
347
|
+
sys.path = []
|
|
348
|
+
|
|
349
|
+
# init the dev environment
|
|
350
|
+
try:
|
|
351
|
+
envstack.init("dev")
|
|
352
|
+
import yaml
|
|
353
|
+
success = yaml is not None
|
|
354
|
+
except ImportError:
|
|
355
|
+
success = False
|
|
356
|
+
|
|
357
|
+
self.assertTrue(success)
|
|
358
|
+
self.assertTrue("yaml" in sys.modules)
|
|
359
|
+
self.assertTrue(len(sys.path) > 0)
|
|
360
|
+
|
|
341
361
|
|
|
342
362
|
if __name__ == "__main__":
|
|
343
363
|
unittest.main()
|
|
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
|
|
File without changes
|