From 9d600cb0856dfa91abec65441f5a288de06d1eca Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 15:38:10 +0100 Subject: [PATCH 01/23] Add processing selectors and tests. --- conda_devenv/devenv.py | 30 ++++++- tests/test_jinja.py | 191 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+), 3 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index aad9646..c1120a2 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -12,12 +12,36 @@ def render_jinja(contents, filename, is_included): import sys import platform + pyversion = platform.python_version().split('.') + + iswin = sys.platform.startswith('win') + islinux = sys.platform.startswith('linux') + isosx = sys.platform.startswith('darwin') + + is32bit = '32bit' == platform.architecture()[0] + is64bit = not is32bit + jinja_dict = { - "is_included": is_included, - "os": os, - "platform": platform, "root": os.path.dirname(os.path.abspath(filename)), + "os": os, "sys": sys, + "platform": platform, + "x86": 'x86' == platform.machine(), + "x86_64": 'x86_64' == platform.machine(), + "linux": islinux, + "linux32": islinux and is32bit, + "linux64": islinux and is64bit, + "armv6l": None, + "armv7l": None, + "ppc64le": None, + "osx": isosx, + "unix": islinux or isosx, + "win": iswin, + "win32": iswin and is32bit, + "win64": iswin and is64bit, + "py": int(pyversion[0] + pyversion[1]), + "py2k": pyversion[0] == 2, + "py3k": pyversion[0] == 3, } return jinja2.Template(contents).render(**jinja_dict) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index b3ff3d8..28b474a 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -61,6 +61,197 @@ def test_jinja_platform(monkeypatch): assert render_jinja(template, filename="", is_included=False) == platform.python_revision() +def test_jinja_x86(monkeypatch): + template = "{{ x86 }}" + + monkeypatch.setattr(platform, 'machine', 'x86') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'machine', 'x86_64') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_x86_64(monkeypatch): + template = "{{ x86_64 }}" + + monkeypatch.setattr(platform, 'machine', 'x86') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'machine', 'x86_64') + assert render_jinja(template, filename="", is_included=False) == 'True' + + +def test_jinja_linux(monkeypatch): + template = "{{ linux }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(sys, 'platform', 'win') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(sys, 'platform', 'darwin') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_linux32(monkeypatch): + template = "{{ linux32 }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + + monkeypatch.setattr(platform, 'architecture', '32bit') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'architecture', '64bit') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_linux64(monkeypatch): + template = "{{ linux64 }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + + monkeypatch.setattr(platform, 'architecture', '32bit') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'architecture', '64bit') + assert render_jinja(template, filename="", is_included=False) == 'True' + + +def test_jinja_armv6l(monkeypatch): + template = "{{ armv6l }}" + pass + +def test_jinja_armv7l(monkeypatch): + template = "{{ armv7l }}" + pass + + +def test_jinja_ppc64le(monkeypatch): + template = "{{ ppc64le }}" + pass + + +def test_jinja_osx(monkeypatch): + template = "{{ osx }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(sys, 'platform', 'win') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(sys, 'platform', 'darwin') + assert render_jinja(template, filename="", is_included=False) == 'True' + + +def test_jinja_unix(monkeypatch): + template = "{{ unix }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(sys, 'platform', 'win') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(sys, 'platform', 'darwin') + assert render_jinja(template, filename="", is_included=False) == 'True' + + +def test_jinja_win(monkeypatch): + template = "{{ win }}" + + monkeypatch.setattr(sys, 'platform', 'linux') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(sys, 'platform', 'win') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(sys, 'platform', 'darwin') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_win32(monkeypatch): + template = "{{ win32 }}" + + monkeypatch.setattr(sys, 'platform', 'win') + + monkeypatch.setattr(platform, 'architecture', '32bit') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'architecture', '64bit') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_win64(monkeypatch): + template = "{{ win64 }}" + + monkeypatch.setattr(sys, 'platform', 'win') + + monkeypatch.setattr(platform, 'architecture', '32bit') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'architecture', '64bit') + assert render_jinja(template, filename="", is_included=False) == 'True' + + +def test_jinja_py(monkeypatch): + template = "{{ py }}" + + monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == '27' + + monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + assert render_jinja(template, filename="", is_included=False) == '34' + + monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + assert render_jinja(template, filename="", is_included=False) == '35' + + monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + assert render_jinja(template, filename="", is_included=False) == '36' + + monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == '37' + + +def test_jinja_py2k(monkeypatch): + template = "{{ py2k }}" + + monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'False' + + +def test_jinja_py3k(monkeypatch): + template = "{{ py3k }}" + + monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'False' + + monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'True' + + monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + assert render_jinja(template, filename="", is_included=False) == 'True' + + def test_jinja_invalid_template(): with pytest.raises(jinja2.exceptions.TemplateSyntaxError): render_jinja( From 8c6ecee4a5d3372455cb612c7644e8cc34bcfacd Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 16:01:06 +0100 Subject: [PATCH 02/23] Fix mocking of python functions. --- tests/test_jinja.py | 90 +++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index 28b474a..059f7c9 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -64,22 +64,30 @@ def test_jinja_platform(monkeypatch): def test_jinja_x86(monkeypatch): template = "{{ x86 }}" - monkeypatch.setattr(platform, 'machine', 'x86') + platform_bkp = platform + + platform.machine = lambda : 'x86' assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'machine', 'x86_64') + platform.machine = lambda : 'x86_64' assert render_jinja(template, filename="", is_included=False) == 'False' + platform = platform_bkp + def test_jinja_x86_64(monkeypatch): template = "{{ x86_64 }}" - monkeypatch.setattr(platform, 'machine', 'x86') + platform_bkp = platform + + platform.machine = lambda : 'x86' assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'machine', 'x86_64') + platform.machine = lambda : 'x86_64' assert render_jinja(template, filename="", is_included=False) == 'True' + platform = platform_bkp + def test_jinja_linux(monkeypatch): template = "{{ linux }}" @@ -99,24 +107,32 @@ def test_jinja_linux32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', '32bit') + platform_bkp = platform + + platform.architecture = lambda : ('32bit', '') assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', '64bit') + platform.architecture = lambda : ('64bit', '') assert render_jinja(template, filename="", is_included=False) == 'False' + platform = platform_bkp + def test_jinja_linux64(monkeypatch): template = "{{ linux64 }}" monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', '32bit') + platform_bkp = platform + + platform.architecture = lambda : ('32bit', '') assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', '64bit') + platform.architecture = lambda : ('64bit', '') assert render_jinja(template, filename="", is_included=False) == 'True' + platform = platform_bkp + def test_jinja_armv6l(monkeypatch): template = "{{ armv6l }}" @@ -176,81 +192,101 @@ def test_jinja_win32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', '32bit') + platform_bkp = platform + + platform.architecture = lambda : ('32bit', '') assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', '64bit') + platform.architecture = lambda : ('64bit', '') assert render_jinja(template, filename="", is_included=False) == 'False' + platform = platform_bkp + def test_jinja_win64(monkeypatch): template = "{{ win64 }}" monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', '32bit') + platform_bkp = platform + + platform.architecture = lambda : ('32bit', '') assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', '64bit') + platform.architecture = lambda : ('64bit', '') assert render_jinja(template, filename="", is_included=False) == 'True' + platform = platform_bkp + def test_jinja_py(monkeypatch): template = "{{ py }}" - monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + platform_bkp = platform + + platform.python_version = lambda : '2.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == '27' - monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + platform.python_version = lambda : '3.4.XYZ+' assert render_jinja(template, filename="", is_included=False) == '34' - monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + platform.python_version = lambda : '3.5.XYZ+' assert render_jinja(template, filename="", is_included=False) == '35' - monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + platform.python_version = lambda : '3.6.XYZ+' assert render_jinja(template, filename="", is_included=False) == '36' - monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + platform.python_version = lambda : '3.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == '37' + platform = platform_bkp + def test_jinja_py2k(monkeypatch): template = "{{ py2k }}" - monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + platform_bkp = platform + + platform.python_version = lambda : '2.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + platform.python_version = lambda : '3.4.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + platform.python_version = lambda : '3.5.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + platform.python_version = lambda : '3.6.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + platform.python_version = lambda : '3.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'False' + platform = platform_bkp + def test_jinja_py3k(monkeypatch): template = "{{ py3k }}" - monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') + platform_bkp = platform + + platform.python_version = lambda : '2.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') + platform.python_version = lambda : '3.4.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') + platform.python_version = lambda : '3.5.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') + platform.python_version = lambda : '3.6.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') + platform.python_version = lambda : '3.7.XYZ+' assert render_jinja(template, filename="", is_included=False) == 'True' + platform = platform_bkp + def test_jinja_invalid_template(): with pytest.raises(jinja2.exceptions.TemplateSyntaxError): From 10512bd1ea65b9356987e32cf0ae24070316d350 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 16:05:10 +0100 Subject: [PATCH 03/23] Add back deleted key-value pairs by mistake. --- conda_devenv/devenv.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index c1120a2..661e687 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -21,11 +21,13 @@ def render_jinja(contents, filename, is_included): is32bit = '32bit' == platform.architecture()[0] is64bit = not is32bit + jinja_dict = { - "root": os.path.dirname(os.path.abspath(filename)), + "is_included": is_included, "os": os, - "sys": sys, "platform": platform, + "root": os.path.dirname(os.path.abspath(filename)), + "sys": sys, "x86": 'x86' == platform.machine(), "x86_64": 'x86_64' == platform.machine(), "linux": islinux, From 4db77010f24a3044e4fef73122994fe1c8c38be6 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 16:06:32 +0100 Subject: [PATCH 04/23] [skip ci] Delete a blank line. --- conda_devenv/devenv.py | 1 - 1 file changed, 1 deletion(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 661e687..ad69d01 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -21,7 +21,6 @@ def render_jinja(contents, filename, is_included): is32bit = '32bit' == platform.architecture()[0] is64bit = not is32bit - jinja_dict = { "is_included": is_included, "os": os, From e5fe7c58d64604f14af182598b2dd952eca61942 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 17:12:22 +0100 Subject: [PATCH 05/23] Remove py py2k, py3k, and use mock with lambda. --- conda_devenv/devenv.py | 3 -- tests/test_jinja.py | 108 +++++++---------------------------------- 2 files changed, 17 insertions(+), 94 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index ad69d01..76220a6 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -40,9 +40,6 @@ def render_jinja(contents, filename, is_included): "win": iswin, "win32": iswin and is32bit, "win64": iswin and is64bit, - "py": int(pyversion[0] + pyversion[1]), - "py2k": pyversion[0] == 2, - "py3k": pyversion[0] == 3, } return jinja2.Template(contents).render(**jinja_dict) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index 059f7c9..5fcf91f 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -64,30 +64,22 @@ def test_jinja_platform(monkeypatch): def test_jinja_x86(monkeypatch): template = "{{ x86 }}" - platform_bkp = platform - - platform.machine = lambda : 'x86' + monkeypatch.setattr(platform, 'machine', 'x86') assert render_jinja(template, filename="", is_included=False) == 'True' - platform.machine = lambda : 'x86_64' + monkeypatch.setattr(platform, 'machine', 'x86_64') assert render_jinja(template, filename="", is_included=False) == 'False' - platform = platform_bkp - def test_jinja_x86_64(monkeypatch): template = "{{ x86_64 }}" - platform_bkp = platform - - platform.machine = lambda : 'x86' + monkeypatch.setattr(platform, 'machine', 'x86') assert render_jinja(template, filename="", is_included=False) == 'False' - platform.machine = lambda : 'x86_64' + monkeypatch.setattr(platform, 'machine', 'x86_64') assert render_jinja(template, filename="", is_included=False) == 'True' - platform = platform_bkp - def test_jinja_linux(monkeypatch): template = "{{ linux }}" @@ -107,32 +99,24 @@ def test_jinja_linux32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - platform_bkp = platform - - platform.architecture = lambda : ('32bit', '') + monkeypatch.setattr(platform, 'architecture', '32bit') assert render_jinja(template, filename="", is_included=False) == 'True' - platform.architecture = lambda : ('64bit', '') + monkeypatch.setattr(platform, 'architecture', '64bit') assert render_jinja(template, filename="", is_included=False) == 'False' - platform = platform_bkp - def test_jinja_linux64(monkeypatch): template = "{{ linux64 }}" monkeypatch.setattr(sys, 'platform', 'linux') - platform_bkp = platform - - platform.architecture = lambda : ('32bit', '') + monkeypatch.setattr(platform, 'architecture', '32bit') assert render_jinja(template, filename="", is_included=False) == 'False' - platform.architecture = lambda : ('64bit', '') + monkeypatch.setattr(platform, 'architecture', '64bit') assert render_jinja(template, filename="", is_included=False) == 'True' - platform = platform_bkp - def test_jinja_armv6l(monkeypatch): template = "{{ armv6l }}" @@ -192,101 +176,43 @@ def test_jinja_win32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - platform_bkp = platform - - platform.architecture = lambda : ('32bit', '') + monkeypatch.setattr(platform, 'architecture', '32bit') assert render_jinja(template, filename="", is_included=False) == 'True' - platform.architecture = lambda : ('64bit', '') + monkeypatch.setattr(platform, 'architecture', '64bit') assert render_jinja(template, filename="", is_included=False) == 'False' - platform = platform_bkp - def test_jinja_win64(monkeypatch): template = "{{ win64 }}" monkeypatch.setattr(sys, 'platform', 'win') - platform_bkp = platform - - platform.architecture = lambda : ('32bit', '') + monkeypatch.setattr(platform, 'architecture', '32bit') assert render_jinja(template, filename="", is_included=False) == 'False' - platform.architecture = lambda : ('64bit', '') + monkeypatch.setattr(platform, 'architecture', '64bit') assert render_jinja(template, filename="", is_included=False) == 'True' - platform = platform_bkp - def test_jinja_py(monkeypatch): template = "{{ py }}" - platform_bkp = platform - - platform.python_version = lambda : '2.7.XYZ+' + monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') assert render_jinja(template, filename="", is_included=False) == '27' - platform.python_version = lambda : '3.4.XYZ+' + monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') assert render_jinja(template, filename="", is_included=False) == '34' - platform.python_version = lambda : '3.5.XYZ+' + monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') assert render_jinja(template, filename="", is_included=False) == '35' - platform.python_version = lambda : '3.6.XYZ+' + monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') assert render_jinja(template, filename="", is_included=False) == '36' - platform.python_version = lambda : '3.7.XYZ+' + monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') assert render_jinja(template, filename="", is_included=False) == '37' - platform = platform_bkp - - -def test_jinja_py2k(monkeypatch): - template = "{{ py2k }}" - - platform_bkp = platform - - platform.python_version = lambda : '2.7.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'True' - - platform.python_version = lambda : '3.4.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'False' - - platform.python_version = lambda : '3.5.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'False' - - platform.python_version = lambda : '3.6.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'False' - - platform.python_version = lambda : '3.7.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'False' - - platform = platform_bkp - - -def test_jinja_py3k(monkeypatch): - template = "{{ py3k }}" - - platform_bkp = platform - - platform.python_version = lambda : '2.7.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'False' - - platform.python_version = lambda : '3.4.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'True' - - platform.python_version = lambda : '3.5.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'True' - - platform.python_version = lambda : '3.6.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'True' - - platform.python_version = lambda : '3.7.XYZ+' - assert render_jinja(template, filename="", is_included=False) == 'True' - - platform = platform_bkp - def test_jinja_invalid_template(): with pytest.raises(jinja2.exceptions.TemplateSyntaxError): From 751a31ba17404aa4be60e4dd8b5c40650127d295 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 17:18:33 +0100 Subject: [PATCH 06/23] Add forgotten lambda functions! --- tests/test_jinja.py | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index 5fcf91f..f05b6fb 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -64,20 +64,20 @@ def test_jinja_platform(monkeypatch): def test_jinja_x86(monkeypatch): template = "{{ x86 }}" - monkeypatch.setattr(platform, 'machine', 'x86') + monkeypatch.setattr(platform, 'machine', lambda: 'x86') assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'machine', 'x86_64') + monkeypatch.setattr(platform, 'machine', lambda: 'x86_64') assert render_jinja(template, filename="", is_included=False) == 'False' def test_jinja_x86_64(monkeypatch): template = "{{ x86_64 }}" - monkeypatch.setattr(platform, 'machine', 'x86') + monkeypatch.setattr(platform, 'machine', lambda: 'x86') assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'machine', 'x86_64') + monkeypatch.setattr(platform, 'machine', lambda: 'x86_64') assert render_jinja(template, filename="", is_included=False) == 'True' @@ -99,10 +99,10 @@ def test_jinja_linux32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: '32bit') assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: '64bit') assert render_jinja(template, filename="", is_included=False) == 'False' @@ -111,10 +111,10 @@ def test_jinja_linux64(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: '32bit') assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: '64bit') assert render_jinja(template, filename="", is_included=False) == 'True' @@ -176,10 +176,10 @@ def test_jinja_win32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: '32bit') assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: '64bit') assert render_jinja(template, filename="", is_included=False) == 'False' @@ -188,32 +188,13 @@ def test_jinja_win64(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: '32bit') assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: '64bit') assert render_jinja(template, filename="", is_included=False) == 'True' -def test_jinja_py(monkeypatch): - template = "{{ py }}" - - monkeypatch.setattr(platform, 'python_version', '2.7.XYZ+') - assert render_jinja(template, filename="", is_included=False) == '27' - - monkeypatch.setattr(platform, 'python_version', '3.4.XYZ+') - assert render_jinja(template, filename="", is_included=False) == '34' - - monkeypatch.setattr(platform, 'python_version', '3.5.XYZ+') - assert render_jinja(template, filename="", is_included=False) == '35' - - monkeypatch.setattr(platform, 'python_version', '3.6.XYZ+') - assert render_jinja(template, filename="", is_included=False) == '36' - - monkeypatch.setattr(platform, 'python_version', '3.7.XYZ+') - assert render_jinja(template, filename="", is_included=False) == '37' - - def test_jinja_invalid_template(): with pytest.raises(jinja2.exceptions.TemplateSyntaxError): render_jinja( From bf1a366f0b3c22bd7ff811761cb729748fedb75d Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 17:53:29 +0100 Subject: [PATCH 07/23] Remove unused variable pyversion. --- conda_devenv/devenv.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 76220a6..3fc09e9 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -12,8 +12,6 @@ def render_jinja(contents, filename, is_included): import sys import platform - pyversion = platform.python_version().split('.') - iswin = sys.platform.startswith('win') islinux = sys.platform.startswith('linux') isosx = sys.platform.startswith('darwin') From e5999d401bbed1acc58256c53fc16445ac2c3b8f Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:02:41 +0100 Subject: [PATCH 08/23] Fix lambda - need return of a tuple --- tests/test_jinja.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index f05b6fb..8b92b27 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -99,10 +99,10 @@ def test_jinja_linux32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', lambda: '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('32bit', '')) assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', lambda: '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('64bit', '')) assert render_jinja(template, filename="", is_included=False) == 'False' @@ -111,10 +111,10 @@ def test_jinja_linux64(monkeypatch): monkeypatch.setattr(sys, 'platform', 'linux') - monkeypatch.setattr(platform, 'architecture', lambda: '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('32bit', '')) assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', lambda: '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('64bit', '')) assert render_jinja(template, filename="", is_included=False) == 'True' @@ -176,10 +176,10 @@ def test_jinja_win32(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', lambda: '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('32bit', '')) assert render_jinja(template, filename="", is_included=False) == 'True' - monkeypatch.setattr(platform, 'architecture', lambda: '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('64bit', '')) assert render_jinja(template, filename="", is_included=False) == 'False' @@ -188,10 +188,10 @@ def test_jinja_win64(monkeypatch): monkeypatch.setattr(sys, 'platform', 'win') - monkeypatch.setattr(platform, 'architecture', lambda: '32bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('32bit', '')) assert render_jinja(template, filename="", is_included=False) == 'False' - monkeypatch.setattr(platform, 'architecture', lambda: '64bit') + monkeypatch.setattr(platform, 'architecture', lambda: ('64bit', '')) assert render_jinja(template, filename="", is_included=False) == 'True' From ebb387f9b1d5addfbe41a679a14e3f9da2f22436 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:32:38 +0100 Subject: [PATCH 09/23] Update usage docs. --- docs/usage.rst | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/usage.rst b/docs/usage.rst index 75be2b5..e3abd85 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -20,10 +20,22 @@ based python version, etc. For example: name: web-ui-py{{ conda_py }} dependencies: - {% if sys.platform.startswith('linux') %} + - boost + - cmake + {% if linux %} - gcc {% endif %} + {% if unix %} + - ccache + {% endif %} + {% if win %} + - clcache + {% endif %} +Note that in the example above, we are able to define dependency requirements +that are specific to Linux, macOS, and Windows (e.g., `ccache` is needed in +Linux and macOS, whereas `clcache` is needed in Windows). This is one of the +most useful capabilities of ``conda-devenv``. The following variables are available in the Jira 2 namespace: @@ -31,6 +43,16 @@ The following variables are available in the Jira 2 namespace: * ``os``: standard module; * ``sys``: standard module; * ``platform``: standard module; +* ``x86``: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. +* ``x86_64``: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. +* ``linux``: ``True`` if the platform is Linux. +* ``linux32``: ``True`` if the platform is Linux and the Python architecture is 32-bit. +* ``linux64``: ``True`` if the platform is Linux and the Python architecture is 64-bit. +* ``osx``: ``True`` if the platform is macOS. +* ``unix``: ``True`` if the platform is either macOS or Linux. +* ``win``: ``True`` if the platform is Windows. +* ``win32``: ``True`` if the platform is Windows and the Python architecture is 32-bit. +* ``win64``: ``True`` if the platform is Windows and the Python architecture is 64-bit. Environment Variables From 20e1f8deb34c611a139fa929a5f71525ab368ff5 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:39:32 +0100 Subject: [PATCH 10/23] Further improvements. --- docs/usage.rst | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index e3abd85..79325ab 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -39,20 +39,20 @@ most useful capabilities of ``conda-devenv``. The following variables are available in the Jira 2 namespace: -* ``root``: this is the full path to the directory containing the ``environment.devenv.yml`` file; -* ``os``: standard module; -* ``sys``: standard module; -* ``platform``: standard module; -* ``x86``: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. -* ``x86_64``: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. -* ``linux``: ``True`` if the platform is Linux. -* ``linux32``: ``True`` if the platform is Linux and the Python architecture is 32-bit. -* ``linux64``: ``True`` if the platform is Linux and the Python architecture is 64-bit. -* ``osx``: ``True`` if the platform is macOS. -* ``unix``: ``True`` if the platform is either macOS or Linux. -* ``win``: ``True`` if the platform is Windows. -* ``win32``: ``True`` if the platform is Windows and the Python architecture is 32-bit. -* ``win64``: ``True`` if the platform is Windows and the Python architecture is 64-bit. +* :command:`root`: this is the full path to the directory containing the ``environment.devenv.yml`` file. +* :command:`os`: the standard Python module object obtained with ``import os``. +* :command:`sys`: the standard Python module object obtained with ``import sys``. +* :command:`platform`: the standard Python module object obtained with ``import platform``. +* :command:`x86`: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. +* :command:`x86_64`: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. +* :command:`linux`: ``True`` if the platform is Linux. +* :command:`linux32`: ``True`` if the platform is Linux and the Python architecture is 32-bit. +* :command:`linux64`: ``True`` if the platform is Linux and the Python architecture is 64-bit. +* :command:`osx`: ``True`` if the platform is macOS. +* :command:`unix`: ``True`` if the platform is either macOS or Linux. +* :command:`win`: ``True`` if the platform is Windows. +* :command:`win32`: ``True`` if the platform is Windows and the Python architecture is 32-bit. +* :command:`win64`: ``True`` if the platform is Windows and the Python architecture is 64-bit. Environment Variables From 87b3c0a7c8608b81240c911097d1445c1a9bebac Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:41:34 +0100 Subject: [PATCH 11/23] Remove command role. --- docs/usage.rst | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 79325ab..205d929 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -39,20 +39,20 @@ most useful capabilities of ``conda-devenv``. The following variables are available in the Jira 2 namespace: -* :command:`root`: this is the full path to the directory containing the ``environment.devenv.yml`` file. -* :command:`os`: the standard Python module object obtained with ``import os``. -* :command:`sys`: the standard Python module object obtained with ``import sys``. -* :command:`platform`: the standard Python module object obtained with ``import platform``. -* :command:`x86`: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. -* :command:`x86_64`: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. -* :command:`linux`: ``True`` if the platform is Linux. -* :command:`linux32`: ``True`` if the platform is Linux and the Python architecture is 32-bit. -* :command:`linux64`: ``True`` if the platform is Linux and the Python architecture is 64-bit. -* :command:`osx`: ``True`` if the platform is macOS. -* :command:`unix`: ``True`` if the platform is either macOS or Linux. -* :command:`win`: ``True`` if the platform is Windows. -* :command:`win32`: ``True`` if the platform is Windows and the Python architecture is 32-bit. -* :command:`win64`: ``True`` if the platform is Windows and the Python architecture is 64-bit. +* ``root``: this is the full path to the directory containing the ``environment.devenv.yml`` file. +* ``os``: the standard Python module object obtained with ``import os``. +* ``sys``: the standard Python module object obtained with ``import sys``. +* ``platform``: the standard Python module object obtained with ``import platform``. +* ``x86``: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. +* ``x86_64``: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. +* ``linux``: ``True`` if the platform is Linux. +* ``linux32``: ``True`` if the platform is Linux and the Python architecture is 32-bit. +* ``linux64``: ``True`` if the platform is Linux and the Python architecture is 64-bit. +* ``osx``: ``True`` if the platform is macOS. +* ``unix``: ``True`` if the platform is either macOS or Linux. +* ``win``: ``True`` if the platform is Windows. +* ``win32``: ``True`` if the platform is Windows and the Python architecture is 32-bit. +* ``win64``: ``True`` if the platform is Windows and the Python architecture is 64-bit. Environment Variables From ba1e330a6093238f7b02de81433f5688bdad7627 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:42:40 +0100 Subject: [PATCH 12/23] Missing `` --- docs/usage.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 205d929..8ef6c60 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -33,8 +33,8 @@ based python version, etc. For example: {% endif %} Note that in the example above, we are able to define dependency requirements -that are specific to Linux, macOS, and Windows (e.g., `ccache` is needed in -Linux and macOS, whereas `clcache` is needed in Windows). This is one of the +that are specific to Linux, macOS, and Windows (e.g., ``ccache`` is needed in +Linux and macOS, whereas ``clcache`` is needed in Windows). This is one of the most useful capabilities of ``conda-devenv``. The following variables are available in the Jira 2 namespace: From 9bdf187c9aeebf67a999569242346485dc9bf024 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 18:48:48 +0100 Subject: [PATCH 13/23] Using table as in conda-build docs --- docs/usage.rst | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 8ef6c60..d3e1e94 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -39,20 +39,37 @@ most useful capabilities of ``conda-devenv``. The following variables are available in the Jira 2 namespace: -* ``root``: this is the full path to the directory containing the ``environment.devenv.yml`` file. -* ``os``: the standard Python module object obtained with ``import os``. -* ``sys``: the standard Python module object obtained with ``import sys``. -* ``platform``: the standard Python module object obtained with ``import platform``. -* ``x86``: ``True`` if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. -* ``x86_64``: ``True`` if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. -* ``linux``: ``True`` if the platform is Linux. -* ``linux32``: ``True`` if the platform is Linux and the Python architecture is 32-bit. -* ``linux64``: ``True`` if the platform is Linux and the Python architecture is 64-bit. -* ``osx``: ``True`` if the platform is macOS. -* ``unix``: ``True`` if the platform is either macOS or Linux. -* ``win``: ``True`` if the platform is Windows. -* ``win32``: ``True`` if the platform is Windows and the Python architecture is 32-bit. -* ``win64``: ``True`` if the platform is Windows and the Python architecture is 64-bit. +.. list-table:: + :widths: 20 80 + + * - root + - The full path to the directory containing the ``environment.devenv.yml`` file. + * - os + - The standard Python module object obtained with ``import os``. + * - sys + - The standard Python module object obtained with ``import sys``. + * - platform + - The standard Python module object obtained with ``import platform``. + * - x86 + - True if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. + * - x86_64 + - True if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. + * - linux + - True if the platform is Linux. + * - linux32 + - True if the platform is Linux and the Python architecture is 32-bit. + * - linux64 + - True if the platform is Linux and the Python architecture is 64-bit. + * - osx + - True if the platform is macOS. + * - unix + - True if the platform is either macOS or Linux. + * - win + - True if the platform is Windows. + * - win32 + - True if the platform is Windows and the Python architecture is 32-bit. + * - win64 + - True if the platform is Windows and the Python architecture is 64-bit. Environment Variables From 14c495a81d330ee8af7224767e426130b17838a3 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:25:48 +0100 Subject: [PATCH 14/23] Add sphinx_rtd_theme dependency --- requirements_dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements_dev.txt b/requirements_dev.txt index 05897a8..977cb09 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,6 @@ PyYAML Sphinx +sphinx_rtd_theme bumpversion coverage cryptography From 9376f8175a73653e1ccd3596dceb34f144cbb333 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:26:07 +0100 Subject: [PATCH 15/23] Set sphinx_rdt_theme as the theme for docs. --- docs/conf.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 2ff8795..cb36e4a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -97,7 +97,7 @@ #show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'default' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] @@ -111,7 +111,9 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +import sphinx_rtd_theme +html_theme = 'sphinx_rtd_theme' +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the From 675d536cbbfadbe4fee15e4a1f9d2986a9ddeccf Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:26:29 +0100 Subject: [PATCH 16/23] Add an overview of conda-devenv before contents section. --- docs/index.rst | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 804df6c..f07c62f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,65 @@ Welcome to conda-devenv's documentation! ======================================== +Overview +-------- + +With ``conda-devenv``, we help you manage software dependencies across Linux, Windows, and macOS +operating systems using a *single conda dependency file* ``environment.devenv.yml`` +instead of multiple ``environment.yml`` files. + +See example below: + +.. code-block:: yaml + + name: mylib + + dependencies: + - cmake + - eigen + - pip: + - sphinx + {% if linux %} + - gxx_linux-64=7.3.0 + {% endif %} + + {% if unix %} + - ccache + {% endif %} + + {% if win %} + - clcache + {% endif %} + + environment: + CPATH: + - $CONDA_PREFIX/include + + LD_LIBRARY_PATH: + - $CONDA_PREFIX/lib + +By executing: + +.. code:: + + conda devenv + +in the root of the project directory, an ``environment.yml`` file is produced. +We can now activate the conda environment ``mylib`` as follows: + +.. code:: + + conda activate mylib + +This will not only resolve the dependencies for the current operating system, +but also set environment variables ``CPATH`` and ``LD_LIBRARY_PATH`` to the +list of paths specified in the ``environment.devenv.yml`` file. + +Continue reading to learn more about the full capabilities of ``conda-devenv``! + + Contents: +--------- .. toctree:: :maxdepth: 2 From dad5aaca50905dd2f4a99ff3d6dffba39fc6f221 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:26:45 +0100 Subject: [PATCH 17/23] Adapt the existing example and add table with new variables. --- docs/usage.rst | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index d3e1e94..69c5a5c 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -42,34 +42,34 @@ The following variables are available in the Jira 2 namespace: .. list-table:: :widths: 20 80 - * - root - - The full path to the directory containing the ``environment.devenv.yml`` file. - * - os - - The standard Python module object obtained with ``import os``. - * - sys - - The standard Python module object obtained with ``import sys``. - * - platform - - The standard Python module object obtained with ``import platform``. - * - x86 - - True if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. - * - x86_64 - - True if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. - * - linux - - True if the platform is Linux. - * - linux32 - - True if the platform is Linux and the Python architecture is 32-bit. - * - linux64 - - True if the platform is Linux and the Python architecture is 64-bit. - * - osx - - True if the platform is macOS. - * - unix - - True if the platform is either macOS or Linux. - * - win - - True if the platform is Windows. - * - win32 - - True if the platform is Windows and the Python architecture is 32-bit. - * - win64 - - True if the platform is Windows and the Python architecture is 64-bit. + * - ``root`` + - The full path to the directory containing the ``environment.devenv.yml`` file. + * - ``os`` + - The standard Python module object ``os`` obtained with ``import os``. + * - ``sys`` + - The standard Python module object ``sys`` obtained with ``import sys``. + * - ``platform`` + - The standard Python module object ``platform`` obtained with ``import platform``. + * - ``x86`` + - True if the system architecture is x86, both 32-bit and 64-bit, for Intel or AMD chips. + * - ``x86_64`` + - True if the system architecture is x86_64, which is 64-bit, for Intel or AMD chips. + * - ``linux`` + - True if the platform is Linux. + * - ``linux32`` + - True if the platform is Linux and the Python architecture is 32-bit. + * - ``linux64`` + - True if the platform is Linux and the Python architecture is 64-bit. + * - ``osx`` + - True if the platform is macOS. + * - ``unix`` + - True if the platform is either macOS or Linux. + * - ``win`` + - True if the platform is Windows. + * - ``win32`` + - True if the platform is Windows and the Python architecture is 32-bit. + * - ``win64`` + - True if the platform is Windows and the Python architecture is 64-bit. Environment Variables From 8a29ad788a1a87897d46a05c46ad5b4ef9a9e031 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:40:19 +0100 Subject: [PATCH 18/23] Revert back changes in theme made for local testing. --- docs/conf.py | 4 +--- requirements_dev.txt | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index cb36e4a..2b3624a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,9 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -import sphinx_rtd_theme -html_theme = 'sphinx_rtd_theme' -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the diff --git a/requirements_dev.txt b/requirements_dev.txt index 977cb09..05897a8 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,6 +1,5 @@ PyYAML Sphinx -sphinx_rtd_theme bumpversion coverage cryptography From 065e585970c99d48d1602aade9bb24b1ef58f2a6 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:42:08 +0100 Subject: [PATCH 19/23] Remove some variables related to arm platforms. --- conda_devenv/devenv.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 3fc09e9..6180809 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -30,9 +30,6 @@ def render_jinja(contents, filename, is_included): "linux": islinux, "linux32": islinux and is32bit, "linux64": islinux and is64bit, - "armv6l": None, - "armv7l": None, - "ppc64le": None, "osx": isosx, "unix": islinux or isosx, "win": iswin, From 135f528280bcdfb2b1694f7b480fa756b0745bcd Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Wed, 13 Feb 2019 20:42:08 +0100 Subject: [PATCH 20/23] Remove some variables related to arm platforms. --- conda_devenv/devenv.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py index 3fc09e9..6180809 100644 --- a/conda_devenv/devenv.py +++ b/conda_devenv/devenv.py @@ -30,9 +30,6 @@ def render_jinja(contents, filename, is_included): "linux": islinux, "linux32": islinux and is32bit, "linux64": islinux and is64bit, - "armv6l": None, - "armv7l": None, - "ppc64le": None, "osx": isosx, "unix": islinux or isosx, "win": iswin, From d82c10122b604e28e77a1d3f941d9dcc2fa1f533 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Thu, 14 Feb 2019 09:06:29 +0100 Subject: [PATCH 21/23] Remove non implemented tests. --- tests/test_jinja.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/test_jinja.py b/tests/test_jinja.py index 8b92b27..104a3eb 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -118,20 +118,6 @@ def test_jinja_linux64(monkeypatch): assert render_jinja(template, filename="", is_included=False) == 'True' -def test_jinja_armv6l(monkeypatch): - template = "{{ armv6l }}" - pass - -def test_jinja_armv7l(monkeypatch): - template = "{{ armv7l }}" - pass - - -def test_jinja_ppc64le(monkeypatch): - template = "{{ ppc64le }}" - pass - - def test_jinja_osx(monkeypatch): template = "{{ osx }}" From 3304d4a435ec0f7e9e34de98b40557f1de1149d2 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Thu, 14 Feb 2019 12:15:32 +0100 Subject: [PATCH 22/23] Revert sphinx theme to sphinx --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 2b3624a..eea20c8 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,7 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'sphinx' # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the From e393996872c75dd2701b3034afedfa41c4546882 Mon Sep 17 00:00:00 2001 From: Allan Leal Date: Thu, 14 Feb 2019 13:25:37 +0100 Subject: [PATCH 23/23] Fix pygments_style and html_theme back to original --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index eea20c8..2ff8795 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -97,7 +97,7 @@ #show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'default' +pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] @@ -111,7 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx' +html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the