Bug 243971

Summary: [NEW PORT] www/py-gdown: Download files from google drive
Product: Ports & Packages Reporter: Shane <FreeBSD>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Only Me CC: FreeBSD, python
Priority: --- Keywords: feature, needs-patch, needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (FreeBSD)
Hardware: Any   
OS: Any   
Description Flags
new port www/py-gdown
new port www/py-gdown none

Description Shane 2020-02-08 02:52:11 UTC
Created attachment 211464 [details]
new port www/py-gdown

New port www/py-gdown
python module and cli cmd to download files from google drive.
This handles the "unable to scan" warning on larger files that cause wget/curl to fail.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2020-02-08 03:14:36 UTC
gdown depends on "requests[socks]" , the "requests" packages extras_require=socks[...] dependency list [1].

When declaring dependencies for packages that declare dependencies on package[extras] form, the port must depend on those dependencies directly [2]

requests[socks] is currently defined in requests setup.py [3] as:

  extras_require { 'socks': ['PySocks>=1.5.6, !=1.5.7'], }

If, in fact, "socks" functionality in gdown is *not* compulsory, but instead OPTIONAL, then gdown should list and declare the socks dependency in extras_require (optional dependencies), not install_requires (compulsory dependencies)

gdown, could for example do:

  install_requires = requests (compulsory base requests functionality)
  extras_require = requests[socks], or directly on pysocks (optional socks support)

[1] gdown:setup.py: install_requires=['filelock', 'requests[socks]', 'six', 'tqdm'],
[2] https://wiki.freebsd.org/Python/PortsPolicy#Transitive_Dependencies
[3] requests:setup.py:extras_requite = { ... , 'socks': ['PySocks>=1.5.6, !=1.5.7'], ... }
Comment 2 Shane 2020-02-09 02:58:19 UTC
I just thought requests[socks] was part of www/py-requests.

py-requests depends on py-urllib3 which optionally depends on py-pysocks, and is on by default.

gdown passes any proxy options to requests through `sess.proxies = {...}` then the call to `sess.get()` is in a try block which catches proxy errors. That should leave a nice failed message if trying to use a proxy with SOCKS disabled/unavailable in py-urllib3.


So as gdown doesn't directly rely on or call py-pysocks, does that count as needing to be listed as an optional port dependency? It does mean the projects setup.py could use some adjustment.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2020-02-09 08:44:27 UTC
What other transitive dependencies are is not related in the sense that whatever is declared and configured as dependencies in a setup.py *must be* satisfied, otherwise run time errors will occur (prior to even using/importing that functionality)

If a package fails gracefully if a dependency is not available, whether as an error message ("foo functionality requires installing package: foo"), just continues in the absence of a module, or otherwise fallback to an alternative method, then yes, it is effectively optional (more precisely; not *compulsory*), and should be declared elsewhere (not in install_requires)
Comment 4 Shane 2020-02-09 09:17:09 UTC
Created attachment 211494 [details]
new port www/py-gdown

add patch to move socks from install_requires to extras_require