Skip to content

Commit

Permalink
fixes compatibility for pipenv>=2023.10.24
Browse files Browse the repository at this point in the history
  • Loading branch information
hraza07 committed Nov 2, 2023
1 parent 9b426ef commit 5dfbf6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shub/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,15 @@ def _get_pipfile_requirements(tmpdir=None):
return open(_add_sources(convert_deps_to_pip(deps), _sources=sources.encode(), tmpdir=tmpdir), 'rb')


def _add_sources(_requirements: Union[str, list], _sources: bytes, tmpdir: Optional[AnyStr] = None) -> str:
def _add_sources(_requirements: Union[str, list,dict], _sources: bytes, tmpdir: Optional[AnyStr] = None) -> str:
tmp = tempfile.NamedTemporaryFile(delete=False, suffix="-requirements.txt", dir=tmpdir)
tmp.write(_sources + b'\n')
# Keep backward compatibility with pipenv<=2022.8.30
if isinstance(_requirements, list):
tmp.write('\n'.join(_requirements).encode('utf-8'))
# Keep compatible with pipenv>=v2023.10.24
elif isinstance(_requirements, dict):
tmp.write('\n'.join(_requirements.values()).encode('utf-8'))
else:
with open(_requirements, 'rb') as f:
tmp.write(f.read())
Expand Down

0 comments on commit 5dfbf6f

Please sign in to comment.