gitRepo: Rewrite the "urllib.request.urlopen" patch for Python 3
The old variant is still working but setting "cafile" is deprecated
since version 3.6 [0] and generates a warning:
DeprecationWarning: cafile, capath and cadefault are deprecated, use a custom context instead.
But without this patch "fetchRepoProject" still fails with
"error no host given" (see 337380ea1d).
[0]: https://docs.python.org/3.7/library/urllib.request.html#urllib.request.urlopen
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{ stdenv, fetchFromGitHub, makeWrapper
|
||||
, python3, git, gnupg, less, cacert
|
||||
, python3, git, gnupg, less
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -13,13 +13,15 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "1a6vyj7a9qba9nidi6x3hkpvpzikskh5jsagzkx7m95p0hcvvb7v";
|
||||
};
|
||||
|
||||
patches = [ ./import-ssl-module.patch ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ python3 ];
|
||||
|
||||
patchPhase = ''
|
||||
postPatch = ''
|
||||
substituteInPlace repo --replace \
|
||||
'urllib.request.urlopen(url)' \
|
||||
'urllib.request.urlopen(url, cafile="${cacert}/etc/ssl/certs/ca-bundle.crt")'
|
||||
'urllib.request.urlopen(url, context=ssl.create_default_context())'
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
||||
Reference in New Issue
Block a user