saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.11k stars 5.47k forks source link

[BUG] `pip.install` translates `download` to `--download` instead of using it as verb `download` #62604

Open eliasp opened 2 years ago

eliasp commented 2 years ago

Description When trying to only download a pip pkg using pip.install and download=True, pip.install will execute pip install --download ... instead of pip download ... Furthermore, it won't even try to download it, when the pkg is already installed.

Setup

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior

no such option: --download [ERROR ] retcode: 2 [ERROR ] Failed to install packages: standalone. Error: Usage: /usr/bin/python3 -m pip install [options] [package-index-options] ... /usr/bin/python3 -m pip install [options] -r [package-index-options] ... /usr/bin/python3 -m pip install [options] [-e] ... /usr/bin/python3 -m pip install [options] [-e] ... /usr/bin/python3 -m pip install [options] <archive url/path> ...

no such option: --download local:

      ID: standalone
Function: pip.installed
  Result: False
 Comment: Failed to install packages: standalone. Error:
          Usage:
            /usr/bin/python3 -m pip install [options] <requirement specifier> [package-index-options] ...
            /usr/bin/python3 -m pip install [options] -r <requirements file> [package-index-options] ...
            /usr/bin/python3 -m pip install [options] [-e] <vcs project url> ...
            /usr/bin/python3 -m pip install [options] [-e] <local project path> ...
            /usr/bin/python3 -m pip install [options] <archive url/path> ...

          no such option: --download
 Started: 14:20:32.482862
Duration: 1325.012 ms
 Changes:

Summary for local

Succeeded: 0 Failed: 1

Total states run: 1 Total run time: 1.325 s


**Expected behavior**
I'd expect the package to be downloaded, instead of installed.
Furthermore, it should also work to download a package, even if it's already installed (which doesn't work at the moment).

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Versions Report**
<details><summary>salt --versions-report</summary>
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) 

```yaml
Salt Version:
          Salt: 3005

Dependency Versions:
          cffi: 1.15.0
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: 5.0.3
         gitdb: 4.0.9
     gitpython: 3.1.24
        Jinja2: 3.0.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.3
       msgpack: 1.0.3
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.11.0
        pygit2: Not Installed
        Python: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 22.3.0
         smmap: 5.0.0
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: ubuntu 22.04 Jammy Jellyfish
        locale: utf-8
       machine: x86_64
       release: 5.15.0-41-generic
        system: Linux
       version: Ubuntu 22.04 Jammy Jellyfish

Additional context Add any other context about the problem here.

whytewolf commented 2 years ago

this looks to have been broken for a long time. --download hasn't been supported since pip 8. and looking at the newer usage this is most likely going to become more of a feature request to add pip.download and pip.downloaded to follow the proper way it should be used with pip.

This is kind of an old bug and feature request all in one.

OrangeDog commented 2 years ago

A bug doesn't become a feature request just because it's ignored for long enough.

If the intent is to not have the feature for now, then it at least needs to be properly removed.