Skip to content

Commit 55392da

Browse files
authored
Merge pull request #53 from ayan-b/req-comments
setup.py.jj2: Allow comments in requirements.txt
2 parents 3426693 + 9635dda commit 55392da

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.moban.dt/local-README.rst.jj2

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ setup.py
2828
- automatically do git release while uploading to pypi
2929

3030
3. configured to build universial wheels by default
31+
32+
4. comes with a feature of removing comments from requirements.txt while loading
33+
into setup.py
34+
3135
{% endblock %}
3236

3337
{% block bottom_block %}

README.rst

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ setup.py
3737

3838
3. configured to build universial wheels by default
3939

40+
4. comes with a feature of removing comments from requirements.txt while loading
41+
into setup.py
42+
43+
4044
Installation
4145
================================================================================
4246

templates/setup.py.jj2

+13
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,20 @@ if python_implementation == "PyPy":
113113
INSTALL_REQUIRES = [
114114
{% for dependency in dependencies: %}
115115
{% if ';' not in dependency and not dependency.startswith('#'): %}
116+
{% if '#egg=' in dependency: %}
117+
{% set dependency = dependency.split('#egg=') %}
118+
{% set repo_link, egg_name = dependency[0], dependency[1] %}
119+
{% set repo_link = repo_link.strip() %}
120+
{% if '#' in egg_name: %}
121+
{% set egg_name = egg_name.split('#')[0].strip() %}
122+
{% endif %}
123+
'{{[repo_link, egg_name] | join('#egg=')}}',
124+
{% elif '#' in dependency: %}
125+
{% set dependency = dependency.split('#')[0].strip() %}
126+
'{{dependency}}',
127+
{% else %}
116128
'{{dependency}}',
129+
{% endif %}
117130
{% endif %}
118131
{% endfor %}
119132
]

0 commit comments

Comments
 (0)