summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-08-27 00:17:57 +0200
committerMarius Bakke <marius@gnu.org>2022-08-27 00:17:57 +0200
commit1fd262e8d36b4477556ca06b569d39f5604c7176 (patch)
tree5b0c93931c22787df1f56858c827abfd0c2a02f8 /gnu/packages/patches
parentc1a4ef98932799adbd278068fa4fdd8c24fff714 (diff)
parent9f7236e3baf0523c53193c1836ed888e63449f50 (diff)
Merge branch 'master' into staging
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/crawl-upgrade-saves.patch4
-rw-r--r--gnu/packages/patches/guile-fibers-epoll-instance-is-dead.patch99
-rw-r--r--gnu/packages/patches/lcalc-default-parameters-1.patch26
-rw-r--r--gnu/packages/patches/lcalc-default-parameters-2.patch58
-rw-r--r--gnu/packages/patches/lcalc-lcommon-h.patch13
-rw-r--r--gnu/packages/patches/lcalc-using-namespace-std.patch43
-rw-r--r--gnu/packages/patches/lrcalc-includes.patch92
-rw-r--r--gnu/packages/patches/perl-class-methodmaker-reproducible.patch21
-rw-r--r--gnu/packages/patches/python-mypy-12332.patch68
-rw-r--r--gnu/packages/patches/python-mypy-use-sys-path.patch130
10 files changed, 122 insertions, 432 deletions
diff --git a/gnu/packages/patches/crawl-upgrade-saves.patch b/gnu/packages/patches/crawl-upgrade-saves.patch
index 720a94f3e5..831f3c60be 100644
--- a/gnu/packages/patches/crawl-upgrade-saves.patch
+++ b/gnu/packages/patches/crawl-upgrade-saves.patch
@@ -6,8 +6,8 @@ upgrade is required, but guix nulls all file dates,
and crawl would never upgrade saves.
diff -ur a/source/database.cc b/source/database.cc
---- a/source/database.cc 2018-08-09 21:49:26.000000000 -0400
-+++ b/source/database.cc 2018-10-07 18:06:41.022445789 -0400
+--- a/crawl-ref/source/database.cc 2018-08-09 21:49:26.000000000 -0400
++++ b/crawl-ref/source/database.cc 2018-10-07 18:06:41.022445789 -0400
@@ -24,6 +24,7 @@
#include "stringutil.h"
#include "syscalls.h"
diff --git a/gnu/packages/patches/guile-fibers-epoll-instance-is-dead.patch b/gnu/packages/patches/guile-fibers-epoll-instance-is-dead.patch
new file mode 100644
index 0000000000..ba191f765d
--- /dev/null
+++ b/gnu/packages/patches/guile-fibers-epoll-instance-is-dead.patch
@@ -0,0 +1,99 @@
+From 5db4077e9f5166033637d2af9532ec6144b85646 Mon Sep 17 00:00:00 2001
+From: Maxime Devos <maximedevos@telenet.be>
+Date: Thu, 30 Jun 2022 14:21:47 +0000
+Subject: [PATCH 1/2] Fix behaviour of 'epoll-wake!' after 'run-fibers'.
+
+This avoids the "epoll instance is dead" error noticed in
+GNUnet-Scheme's test suite, as reported at
+<https://github.com/wingo/fibers/issues/61>.
+A test is added in the next commit.
+
+This patch has been applied upstream, but there hasn't been
+a new release yet at time of writing.
+
+* fibers/epoll.scm (epoll-wake!)[dead]: Instead of throwing an error,
+just return #t.
+---
+ fibers/epoll.scm | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/fibers/epoll.scm b/fibers/epoll.scm
+index d26db4d..eb63242 100644
+--- a/fibers/epoll.scm
++++ b/fibers/epoll.scm
+@@ -1,6 +1,7 @@
+ ;; epoll
+
+ ;;;; Copyright (C) 2016 Andy Wingo <wingo@pobox.com>
++;;;; Copyright (C) 2022 Maxime Devos <maximedevos@telenet.be>
+ ;;;;
+ ;;;; This library is free software; you can redistribute it and/or
+ ;;;; modify it under the terms of the GNU Lesser General Public
+@@ -135,7 +136,12 @@ epoll wait (if appropriate)."
+ ('waiting
+ (primitive-epoll-wake (fileno (epoll-wake-write-pipe epoll))))
+ ('not-waiting #t)
+- ('dead (error "epoll instance is dead"))))
++ ;; This can happen if a fiber was waiting on a condition and
++ ;; run-fibers completes before the fiber completes and afterwards
++ ;; the condition is signalled. In that case, we don't have to
++ ;; resurrect the fiber or something, we can just do nothing.
++ ;; (Bug report: https://github.com/wingo/fibers/issues/61)
++ ('dead #t)))
+
+ (define (epoll-default-folder fd events seed)
+ (acons fd events seed))
+
+From c01d3853eb56ea4adacc31f51f6e917f8c0abe1c Mon Sep 17 00:00:00 2001
+From: Maxime Devos <maximedevos@telenet.be>
+Date: Thu, 30 Jun 2022 14:18:36 +0000
+Subject: [PATCH 2/2] Test for issue #61.
+
+* tests/conditions.scm: Add a test.
+---
+ tests/conditions.scm | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/tests/conditions.scm b/tests/conditions.scm
+index 505c42a..179605a 100644
+--- a/tests/conditions.scm
++++ b/tests/conditions.scm
+@@ -1,6 +1,7 @@
+ ;; Fibers: cooperative, event-driven user-space threads.
+
+ ;;;; Copyright (C) 2016 Free Software Foundation, Inc.
++;;;; Copyright (C) 2022 Maxime Devos <maximedevos@telenet.be>
+ ;;;;
+ ;;;; This library is free software; you can redistribute it and/or
+ ;;;; modify it under the terms of the GNU Lesser General Public
+@@ -21,6 +22,7 @@
+ #:use-module (fibers)
+ #:use-module (fibers conditions)
+ #:use-module (fibers operations)
++ #:use-module (fibers scheduler)
+ #:use-module (fibers timers))
+
+ (define failed? #f)
+@@ -78,4 +80,22 @@
+ (wait cv)
+ #t))
+
++;; Make a condition, wait for it inside a fiber, let the fiber abruptly
++;; terminate and signal the condition afterwards. This tests for the bug
++;; noticed at <https://github.com/wingo/fibers/issues/61>.
++(assert-equal #t
++ (let ((cv (make-condition)))
++ (run-fibers
++ (lambda ()
++ (spawn-fiber (lambda () (wait cv)))
++ (yield-current-task)) ; let the other fiber wait forever
++ ;; This test relies on not draining -- this is the default,
++ ;; but let's make this explicit.
++ #:drain? #false ;
++ ;; For simplicity, disable concurrency and preemption.
++ ;; That way, we can use 'yield-current-task' instead of an
++ ;; arbitrary sleep time.
++ #:hz 0 #:parallelism 1)
++ (signal-condition! cv)))
++
+ (exit (if failed? 1 0))
diff --git a/gnu/packages/patches/lcalc-default-parameters-1.patch b/gnu/packages/patches/lcalc-default-parameters-1.patch
deleted file mode 100644
index 19b0776320..0000000000
--- a/gnu/packages/patches/lcalc-default-parameters-1.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Patch taken from the Sage packaging system.
-
-diff -Naur lcalc-1.23-vanilla/include/Ldirichlet_series.h lcalc-1.23-fixed-gcc.4.9/include/Ldirichlet_series.h
---- lcalc-1.23-vanilla/include/Ldirichlet_series.h 2012-08-08 23:21:55.000000000 +0200
-+++ lcalc-1.23-fixed-gcc.4.9/include/Ldirichlet_series.h 2014-04-21 14:37:59.027464849 +0200
-@@ -43,7 +43,7 @@
- //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- template <class ttype>
- Complex L_function <ttype>::
--dirichlet_series(Complex s, long long N=-1)
-+dirichlet_series(Complex s, long long N)
- {
- Complex z=0.;
- long long m,n;
-diff -Naur lcalc-1.23-vanilla/include/L.h lcalc-1.23-fixed-gcc.4.9/include/L.h
---- lcalc-1.23-vanilla/include/L.h 2012-08-08 23:21:55.000000000 +0200
-+++ lcalc-1.23-fixed-gcc.4.9/include/L.h 2014-04-21 14:32:04.003467348 +0200
-@@ -491,7 +491,7 @@
-
- //#include "Ldirichlet_series.h" //for computing Dirichlet series
- Complex partial_dirichlet_series(Complex s, long long N1, long long N2);
-- Complex dirichlet_series(Complex s, long long N);
-+ Complex dirichlet_series(Complex s, long long N=-1LL);
-
- //#include "Ltaylor_series.h" //for computing taylor series for Dirichlet series
- //void compute_taylor_series(int N, int K, Complex s_0, Complex *series);
diff --git a/gnu/packages/patches/lcalc-default-parameters-2.patch b/gnu/packages/patches/lcalc-default-parameters-2.patch
deleted file mode 100644
index 1d881ee0c4..0000000000
--- a/gnu/packages/patches/lcalc-default-parameters-2.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-Patch taken from the Sage packaging system.
-
---- lcalc-1.23/include/Lgamma.h 2012-08-08 23:21:55.000000000 +0200
-+++ lcalc-1.23/include/Lgamma.h 2014-05-18 21:15:27.786889718 +0200
-@@ -77,7 +77,7 @@
- //n=0 should just give log_GAMMA(z)... thus making log_GAMMA
- //code obsolete. But leave log_GAMMA intact anyways.
- template <class ttype>
--precise(ttype) log_GAMMA (ttype z,int n=0)
-+precise(ttype) log_GAMMA (ttype z,int n)
- {
- int M;
- precise(ttype) log_G,r,r2,y;
-@@ -230,7 +230,7 @@
- //value exp_w which holds exp(-w)
- //computes G(z,w), so there's an extra w^(-z) factor.
- template <class ttype>
--Complex inc_GAMMA (ttype z,ttype w, const char *method="temme", ttype exp_w = 0, bool recycle=false)
-+Complex inc_GAMMA (ttype z,ttype w, const char *method, ttype exp_w, bool recycle)
- {
-
- Complex G;
-@@ -334,7 +334,7 @@
-
-
- template <class ttype>
--ttype cfrac_GAMMA (ttype z,ttype w, ttype exp_w=0, bool recycle=false) //computes G(z,w) via continued fraction
-+ttype cfrac_GAMMA (ttype z,ttype w, ttype exp_w, bool recycle) //computes G(z,w) via continued fraction
- {
-
- ttype G;
-@@ -424,7 +424,7 @@
- }
-
- template <class ttype>
--ttype asympt_GAMMA (ttype z,ttype w, ttype exp_w = 0, bool recycle=false) //computes G(z,w) via asymptotic series
-+ttype asympt_GAMMA (ttype z,ttype w, ttype exp_w, bool recycle) //computes G(z,w) via asymptotic series
- {
-
- if(my_verbose>3) cout << "called asympt_GAMMA("<<z<<","<<w<<")"<< endl;
-@@ -446,7 +446,7 @@
-
-
- template <class ttype>
--ttype comp_inc_GAMMA (ttype z,ttype w,ttype exp_w = 0, bool recycle=false) //computes g(z,w)
-+ttype comp_inc_GAMMA (ttype z,ttype w,ttype exp_w, bool recycle) //computes g(z,w)
- {
-
- ttype g;
-@@ -604,7 +604,7 @@
- }
-
- template <class ttype>
--Complex gamma_sum(Complex s, int what_type, ttype *coeff, int N, Double g, Complex l, Double Q, Long Period, Complex delta=1, const char *method="temme")
-+Complex gamma_sum(Complex s, int what_type, ttype *coeff, int N, Double g, Complex l, Double Q, Long Period, Complex delta, const char *method)
- {
- Complex SUM=0;
-
diff --git a/gnu/packages/patches/lcalc-lcommon-h.patch b/gnu/packages/patches/lcalc-lcommon-h.patch
deleted file mode 100644
index 897956de64..0000000000
--- a/gnu/packages/patches/lcalc-lcommon-h.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Patch taken from the Sage packaging system.
-
---- src/include/Lcommon.h 2010-01-31 15:16:45.000000000 +0000
-+++ src/include/Lcommon.h 2011-03-08 21:19:11.849443238 +0000
-@@ -25,7 +25,7 @@
- #ifdef USE_MPFR
- inline double lcalc_to_double(const double& x) { return x; }
- #endif
--//inline double lcalc_to_double(const long double& x) { return x; }
-+inline double lcalc_to_double(const long double& x) { return x; }
- inline double lcalc_to_double(const int& x) { return x; }
- inline double lcalc_to_double(const long long& x) { return x; }
- inline double lcalc_to_double(const short& x) { return x; }
diff --git a/gnu/packages/patches/lcalc-using-namespace-std.patch b/gnu/packages/patches/lcalc-using-namespace-std.patch
deleted file mode 100644
index 6e0075fdc8..0000000000
--- a/gnu/packages/patches/lcalc-using-namespace-std.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Patch taken from the Sage packaging system.
-
-diff --git a/include/Lcommon.h b/include/Lcommon.h
-index 1b3be43..bf40532 100644
---- a/include/Lcommon.h
-+++ b/include/Lcommon.h
-@@ -48,7 +48,7 @@ const bool outputSeries=true; // Whether to output the coefficients or just th
-
- // Loop i from m to n
- // Useful in tidying up most for loops
--#define loop(i,m,n) for(typeof(m) i=(m); i!=(n); i++)
-+#define loop(i,m,n) for(auto i=(m); i!=(n); i++)
-
- // A class for calculations involving polynomials of small degree
- // Not efficient enough for huge polynomials
-diff --git a/include/Lcommon_ld.h b/include/Lcommon_ld.h
-index 86ae4df..33c560c 100644
---- a/include/Lcommon_ld.h
-+++ b/include/Lcommon_ld.h
-@@ -53,7 +53,7 @@ const bool outputSeries=true; // Whether to output the coefficients or just th
-
- // Loop i from m to n
- // Useful in tidying up most for loops
--#define loop(i,m,n) for(typeof(m) i=(m); i!=(n); i++)
-+#define loop(i,m,n) for(auto i=(m); i!=(n); i++)
-
- // A class for calculations involving polynomials of small degree
- // Not efficient enough for huge polynomials
-diff --git a/include/Lglobals.h b/include/Lglobals.h
-index 60002e4..ca2606c 100644
---- a/include/Lglobals.h
-+++ b/include/Lglobals.h
-@@ -24,9 +24,9 @@
- #ifndef Lglobals_H
- #define Lglobals_H
-
-+#include <valarray>
- using namespace std;
-
--#include <valarray>
- #ifdef USE_MPFR
- #include "Lgmpfrxx.h"
- typedef mpfr_class Double;
diff --git a/gnu/packages/patches/lrcalc-includes.patch b/gnu/packages/patches/lrcalc-includes.patch
deleted file mode 100644
index e15286905b..0000000000
--- a/gnu/packages/patches/lrcalc-includes.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-Patch taken from the Sage packaging system.
-
-From 4a5e1c8c3c11efdb1cbb4239825a6bf4bf1c52f8 Mon Sep 17 00:00:00 2001
-From: Anders Skovsted Buch <asbuch@math.rutgers.edu>
-Date: Sun, 29 Nov 2015 16:25:56 -0500
-Subject: [PATCH] Patch by Jeroen Demeyer to change include <vector.h> to
- "vector.h", plus similar cases.
-
----
- src/lrcalc.c | 2 +-
- src/maple.c | 4 ++--
- src/schublib.h | 2 +-
- src/symfcn.c | 6 +++---
- src/symfcn.h | 4 ++--
- 5 files changed, 9 insertions(+), 9 deletions(-)
-
-diff --git a/src/lrcalc.c b/src/lrcalc.c
-index aff3f75..60df49e 100644
---- a/src/lrcalc.c
-+++ b/src/lrcalc.c
-@@ -8,7 +8,7 @@
- #include <stdlib.h>
- extern char *optarg;
-
--#include <vectarg.h>
-+#include "vectarg.h"
-
- #include "symfcn.h"
- #include "maple.h"
-diff --git a/src/maple.c b/src/maple.c
-index fdc0768..a5f4d14 100644
---- a/src/maple.c
-+++ b/src/maple.c
-@@ -4,8 +4,8 @@
- */
-
- #include <stdio.h>
--#include <vector.h>
--#include <hashtab.h>
-+#include "vector.h"
-+#include "hashtab.h"
- #include "maple.h"
-
-
-diff --git a/src/schublib.h b/src/schublib.h
-index a8e8511..864850c 100644
---- a/src/schublib.h
-+++ b/src/schublib.h
-@@ -1,7 +1,7 @@
- #ifndef _SCHUBLIB_H
- #define _SCHUBLIB_H
-
--#include <hashtab.h>
-+#include "hashtab.h"
-
- hashtab *trans(vector *w, int vars, hashtab *res);
- hashtab *monk(int i, hashtab *slc, int rank);
-diff --git a/src/symfcn.c b/src/symfcn.c
-index 4ffbe4b..fd5df5d 100644
---- a/src/symfcn.c
-+++ b/src/symfcn.c
-@@ -5,9 +5,9 @@
-
- #include <stdio.h>
-
--#include <alloc.h>
--#include <vector.h>
--#include <hashtab.h>
-+#include "alloc.h"
-+#include "vector.h"
-+#include "hashtab.h"
-
- #include "symfcn.h"
-
-diff --git a/src/symfcn.h b/src/symfcn.h
-index b8543b1..29bb00d 100644
---- a/src/symfcn.h
-+++ b/src/symfcn.h
-@@ -1,8 +1,8 @@
- #ifndef _SYMFCN_H
- #define _SYMFCN_H
-
--#include <hashtab.h>
--#include <vector.h>
-+#include "hashtab.h"
-+#include "vector.h"
-
- int part_itr_sz(vector *part);
- int part_itr_sub(vector *part, vector *outer);
---
-2.1.1.1.g1fb337f
-
diff --git a/gnu/packages/patches/perl-class-methodmaker-reproducible.patch b/gnu/packages/patches/perl-class-methodmaker-reproducible.patch
new file mode 100644
index 0000000000..29a71babd1
--- /dev/null
+++ b/gnu/packages/patches/perl-class-methodmaker-reproducible.patch
@@ -0,0 +1,21 @@
+Description: make build reproducible by sorting hash keys
+ cf. https://reproducible.debian.net/dbd/unstable/amd64/libclass-methodmaker-perl_2.21-1.debbindiff.html
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/778979
+Author: Chris Lamb <lamby@debian.org>
+Reviewed-by: gregor herrmann <gregoa@debian.org>
+Last-Update: 2015-05-02
+Forwarded: https://rt.cpan.org/Ticket/Display.html?id=104163
+Bug: https://rt.cpan.org/Ticket/Display.html?id=104163
+
+--- a/lib/Class/MethodMaker/OptExt.pm
++++ b/lib/Class/MethodMaker/OptExt.pm
+@@ -357,7 +357,7 @@
+
+ # -------------------------------------
+
+-sub option_names { grep $_ ne 'DEFAULT', keys %{OPTEXT()} }
++sub option_names { grep $_ ne 'DEFAULT', sort keys %{OPTEXT()} }
+
+ sub optcode {
+ my $class = shift;
diff --git a/gnu/packages/patches/python-mypy-12332.patch b/gnu/packages/patches/python-mypy-12332.patch
deleted file mode 100644
index d43cf42ed1..0000000000
--- a/gnu/packages/patches/python-mypy-12332.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 518c864805dd93e62d59439e665a0ce9d6778419 Mon Sep 17 00:00:00 2001
-From: Ekin Dursun <ekindursun@gmail.com>
-Date: Thu, 10 Mar 2022 22:06:48 +0300
-Subject: [PATCH] mypyc: Fix overflow in id function (CPyTagged_Id)
-
-In CPython, the id of an object is its address. It's computed by
-converting the pointer to an unsigned integer (PyLong_FromVoidPtr). A
-similar logic is present here, pointer is converted to a Py_ssize_t and
-CPyTagged_FromSsize_t is called with that integer.
-
-There is a problem with that approach: Py_ssize_t cannot hold every
-pointer value. Sometimes overflow happens and CPyTagged_FromSsize_t is
-called with a negative integer.
-
-With the new approach, the number is checked: If it fits in a
-Py_ssize_t, CPyTagged_FromSsize_t is called. If not, it is directly
-converted to a PyObject using PyLong_FromVoidPtr.
----
- mypyc/lib-rt/CPy.h | 1 +
- mypyc/lib-rt/int_ops.c | 9 +++++++++
- mypyc/lib-rt/misc_ops.c | 2 +-
- 3 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/mypyc/lib-rt/CPy.h b/mypyc/lib-rt/CPy.h
-index 987819154ab..9f5ae52d4e4 100644
---- a/mypyc/lib-rt/CPy.h
-+++ b/mypyc/lib-rt/CPy.h
-@@ -121,6 +121,7 @@ static inline size_t CPy_FindAttrOffset(PyTypeObject *trait, CPyVTableItem *vtab
-
-
- CPyTagged CPyTagged_FromSsize_t(Py_ssize_t value);
-+CPyTagged CPyTagged_FromVoidPtr(void *ptr);
- CPyTagged CPyTagged_FromObject(PyObject *object);
- CPyTagged CPyTagged_StealFromObject(PyObject *object);
- CPyTagged CPyTagged_BorrowFromObject(PyObject *object);
-diff --git a/mypyc/lib-rt/int_ops.c b/mypyc/lib-rt/int_ops.c
-index 1275f2c1057..edf06314161 100644
---- a/mypyc/lib-rt/int_ops.c
-+++ b/mypyc/lib-rt/int_ops.c
-@@ -26,6 +26,15 @@ CPyTagged CPyTagged_FromSsize_t(Py_ssize_t value) {
- }
- }
-
-+CPyTagged CPyTagged_FromVoidPtr(void *ptr) {
-+ if ((uintptr_t)ptr > PY_SSIZE_T_MAX) {
-+ PyObject *object = PyLong_FromVoidPtr(ptr);
-+ return ((CPyTagged)object) | CPY_INT_TAG;
-+ } else {
-+ return CPyTagged_FromSsize_t((Py_ssize_t)ptr);
-+ }
-+}
-+
- CPyTagged CPyTagged_FromObject(PyObject *object) {
- int overflow;
- // The overflow check knows about CPyTagged's width
-diff --git a/mypyc/lib-rt/misc_ops.c b/mypyc/lib-rt/misc_ops.c
-index cebd1cf997f..dcce89d9072 100644
---- a/mypyc/lib-rt/misc_ops.c
-+++ b/mypyc/lib-rt/misc_ops.c
-@@ -437,7 +437,7 @@ CPyPickle_GetState(PyObject *obj)
- }
-
- CPyTagged CPyTagged_Id(PyObject *o) {
-- return CPyTagged_FromSsize_t((Py_ssize_t)o);
-+ return CPyTagged_FromVoidPtr(o);
- }
-
- #define MAX_INT_CHARS 22
diff --git a/gnu/packages/patches/python-mypy-use-sys-path.patch b/gnu/packages/patches/python-mypy-use-sys-path.patch
deleted file mode 100644
index 1b12526456..0000000000
--- a/gnu/packages/patches/python-mypy-use-sys-path.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-This patch fixes the annotation files search of mypy on non-FHS distributions.
-
-Submitted upstream: https://github.com/python/mypy/pull/12530
-
-diff --git a/mypy/main.py b/mypy/main.py
-index 3d9836587..f9b0cbd39 100644
---- a/mypy/main.py
-+++ b/mypy/main.py
-@@ -1033,10 +1033,10 @@ def process_options(args: List[str],
- # Set target.
- if special_opts.modules + special_opts.packages:
- options.build_type = BuildType.MODULE
-- egg_dirs, site_packages = get_site_packages_dirs(options.python_executable)
-+ site_packages = get_site_packages_dirs(options.python_executable)
- search_paths = SearchPaths((os.getcwd(),),
- tuple(mypy_path() + options.mypy_path),
-- tuple(egg_dirs + site_packages),
-+ tuple(site_packages),
- ())
- targets = []
- # TODO: use the same cache that the BuildManager will
-diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py
-index 94d2dd34c..337a2d59b 100644
---- a/mypy/modulefinder.py
-+++ b/mypy/modulefinder.py
-@@ -629,7 +629,7 @@ def get_prefixes(python_executable: Optional[str]) -> Tuple[str, str]:
-
-
- @functools.lru_cache(maxsize=None)
--def get_site_packages_dirs(python_executable: Optional[str]) -> Tuple[List[str], List[str]]:
-+def get_site_packages_dirs(python_executable: Optional[str]) -> List[str]:
- """Find package directories for given python.
-
- This runs a subprocess call, which generates a list of the egg directories, and the site
-@@ -648,51 +648,7 @@ def get_site_packages_dirs(python_executable: Optional[str]) -> Tuple[List[str],
- site_packages = ast.literal_eval(
- subprocess.check_output([python_executable, pyinfo.__file__, 'getsitepackages'],
- stderr=subprocess.PIPE).decode())
-- return expand_site_packages(site_packages)
--
--
--def expand_site_packages(site_packages: List[str]) -> Tuple[List[str], List[str]]:
-- """Expands .pth imports in site-packages directories"""
-- egg_dirs: List[str] = []
-- for dir in site_packages:
-- if not os.path.isdir(dir):
-- continue
-- pth_filenames = sorted(name for name in os.listdir(dir) if name.endswith(".pth"))
-- for pth_filename in pth_filenames:
-- egg_dirs.extend(_parse_pth_file(dir, pth_filename))
--
-- return egg_dirs, site_packages
--
--
--def _parse_pth_file(dir: str, pth_filename: str) -> Iterator[str]:
-- """
-- Mimics a subset of .pth import hook from Lib/site.py
-- See https://github.com/python/cpython/blob/3.5/Lib/site.py#L146-L185
-- """
--
-- pth_file = os.path.join(dir, pth_filename)
-- try:
-- f = open(pth_file, "r")
-- except OSError:
-- return
-- with f:
-- for line in f.readlines():
-- if line.startswith("#"):
-- # Skip comment lines
-- continue
-- if line.startswith(("import ", "import\t")):
-- # import statements in .pth files are not supported
-- continue
--
-- yield _make_abspath(line.rstrip(), dir)
--
--
--def _make_abspath(path: str, root: str) -> str:
-- """Take a path and make it absolute relative to root if not already absolute."""
-- if os.path.isabs(path):
-- return os.path.normpath(path)
-- else:
-- return os.path.join(root, os.path.normpath(path))
-+ return site_packages
-
-
- def add_py2_mypypath_entries(mypypath: List[str]) -> List[str]:
-@@ -781,7 +737,7 @@ def compute_search_paths(sources: List[BuildSource],
- if options.python_version[0] == 2:
- mypypath = add_py2_mypypath_entries(mypypath)
-
-- egg_dirs, site_packages = get_site_packages_dirs(options.python_executable)
-+ site_packages = get_site_packages_dirs(options.python_executable)
- base_prefix, prefix = get_prefixes(options.python_executable)
- is_venv = base_prefix != prefix
- for site_dir in site_packages:
-@@ -801,7 +757,7 @@ def compute_search_paths(sources: List[BuildSource],
-
- return SearchPaths(python_path=tuple(reversed(python_path)),
- mypy_path=tuple(mypypath),
-- package_path=tuple(egg_dirs + site_packages),
-+ package_path=tuple(site_packages),
- typeshed_path=tuple(lib_path))
-
-
-diff --git a/mypy/pyinfo.py b/mypy/pyinfo.py
-index ab2d3286b..9fb0501a1 100644
---- a/mypy/pyinfo.py
-+++ b/mypy/pyinfo.py
-@@ -24,16 +24,11 @@ def getprefixes():
-
- def getsitepackages():
- # type: () -> List[str]
-- res = []
-- if hasattr(site, 'getsitepackages'):
-- res.extend(site.getsitepackages())
-
-- if hasattr(site, 'getusersitepackages') and site.ENABLE_USER_SITE:
-- res.insert(0, site.getusersitepackages())
-- else:
-- from distutils.sysconfig import get_python_lib
-- res = [get_python_lib()]
-- return res
-+ # Simply return sys.path, which has already been expanded
-+ # correctly via Python's site.py module, which takes care of .pth,
-+ # sitecustomize.py files, etc.
-+ return sys.path
-
-
- if __name__ == '__main__':