Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hpccm/building_blocks/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class pip(bb_base, hpccm.templates.rm):
upgraded prior to installing any PyPi packages. The default is
False.

index_url: URL of the PyPi index to use. The default is None.

extra_index_url: URL of the extra PyPi index to use. The default is None.

# Examples

```python
Expand Down Expand Up @@ -95,6 +99,8 @@ def __init__(self, **kwargs):
self.__requirements = kwargs.get('requirements', None)
self.__upgrade = kwargs.get('upgrade', False)
self.__wd = kwargs.get('wd', hpccm.config.g_wd) # working directory
self.__index_url = kwargs.get('index_url', None)
self.__extra_index_url = kwargs.get('extra_index_url', None)

self.__debs = [] # Filled in below
self.__rpms = [] # Filled in below
Expand Down Expand Up @@ -167,4 +173,9 @@ def __instructions(self):
if self.__packages:
cmds.append('{0} install {1}'.format(self.__pip,
' '.join(self.__packages)))
if self.__index_url:
cmds[-1] += ' --index-url {0}'.format(self.__index_url)
if self.__extra_index_url:
cmds[-1] += ' --extra-index-url {0}'.format(self.__extra_index_url)

self += shell(commands=cmds)
Loading