Skip to content

Commit 8a2c04a

Browse files
committed
🔨 #86 syntax fix
1 parent c1e4c54 commit 8a2c04a

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

templates/Pipfile.jj2

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,23 @@ python_version= '3.6'
88

99
[packages]
1010
{% for dependency in dependencies: %}
11-
{% if ('=' in dependency) or ('>' in dependency) or ('<' in dependency) %}
12-
{{dependency}}
13-
{% else %}
11+
{% if ('>' in dependency) %}
12+
{%- with dep, ver = dependency.split('>') -%}
13+
{{dep}} = '>{{ver}}'
14+
{% endwith %}
15+
{% elif ('<' in dependency) %}
16+
{%- with dep, ver = dependency.split('<') -%}
17+
{{dep}} = '<{{ver}}'
18+
{% endwith %}
19+
{% elif ('~' in dependency) %}
20+
{%- with dep, ver = dependency.split('~') -%}
21+
{{dep}} = '~{{ver}}'
22+
{% endwith %}
23+
{% elif ('=' in dependency) %}
24+
{%- with dep, ver = dependency.split('=', 1) -%}
25+
{{dep}} = '={{ver}}'
26+
{% endwith %}
27+
{%- else -%}
1428
{{dependency}} = "*"
1529
{% endif %}
1630
{% endfor %}
@@ -23,10 +37,24 @@ coverage = "*"
2337
flake8 = "*"
2438
{% if dev_dependencies is defined %}
2539
{% for dependency in dev_dependencies: %}
26-
{% if ('=' in dependency) or ('>' in dependency) or ('<' in dependency) %}
27-
{{dependency}}
28-
{% else %}
40+
{% if ('>' in dependency) %}
41+
{%- with dep, ver = dependency.split('>') -%}
42+
{{dep}} = '>{{ver}}'
43+
{% endwith %}
44+
{% elif ('<' in dependency) %}
45+
{%- with dep, ver = dependency.split('<') -%}
46+
{{dep}} = '<{{ver}}'
47+
{% endwith %}
48+
{% elif ('~' in dependency) %}
49+
{%- with dep, ver = dependency.split('~') -%}
50+
{{dep}} = '~{{ver}}'
51+
{% endwith %}
52+
{% elif ('=' in dependency) %}
53+
{%- with dep, ver = dependency.split('=', 1) -%}
54+
{{dep}} = '={{ver}}'
55+
{% endwith %}
56+
{%- else -%}
2957
{{dependency}} = "*"
30-
{% endif %}
31-
{% endfor %}
58+
{% endif %}
59+
{%- endfor %}
3260
{% endif %}

0 commit comments

Comments
 (0)