napalm-automation-community / napalm-s350

NAPALM driver for Cisco SMB switches (SF3xx, SF5xx, SG3xx, SG5xx).
Apache License 2.0
16 stars 13 forks source link

setup.py fails with pip>=10 #6

Closed cspeidel closed 3 years ago

cspeidel commented 4 years ago

We need a backwards-compatible fix to the dependency on pip.req in setup.py because it is moved to an internal function in pip 10.

Processing /home/travis/build/napalm-automation-community/napalm-s350
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-PWy1y1/setup.py", line 6, in <module>
        from pip.req import parse_requirements
    ImportError: No module named req
zhengyang-lu commented 4 years ago

I used the solution posted here: https://stackoverflow.com/a/49867265

cspeidel commented 4 years ago

I used the solution posted here: https://stackoverflow.com/a/49867265

I committed a patch to my fork yesterday that doesn't rely on internal methods (pip._internal.req). We should not rely on internal methods because pip could change them at any time without notice. https://github.com/cspeidel/napalm-s350/commit/9ede85bfd14c6ab373aa29840fff75a98ce65c17

Although technically pip says they don't have a public api (https://github.com/pypa/pip/blob/95bcf8c5f6394298035a7332c441868f3b0169f4/news/4696.removal), the leading _ on any method or variable is generally an indicator (although not enforced by Python) of a private method.

Once I fix some of the other tox issues I'll push my develop branch up to the upstream develop branch.

jasperla commented 4 years ago

Note that several other drivers do use the private api (ce and hp-procurve), though I've taken the fix from arubaos-switch in #9.

qaxi commented 3 years ago

Resolved by merge