···1+import pkg_resources
2+import collections
3+import sys
4+5+do_abort = False
6+packages = collections.defaultdict(list)
7+8+for f in sys.path:
9+ for req in pkg_resources.find_distributions(f):
10+ if req not in packages[req.project_name]:
11+ # some exceptions inside buildPythonPackage
12+ if req.project_name in ['setuptools', 'pip', 'wheel']:
13+ continue
14+ packages[req.project_name].append(req)
15+16+17+for name, duplicates in packages.items():
18+ if len(duplicates) > 1:
19+ do_abort = True
20+ print("Found duplicated packages in closure for dependency '{}': ".format(name))
21+ for dup in duplicates:
22+ print(" " + repr(dup))
23+24+if do_abort:
25+ print("")
26+ print(
27+ 'Package duplicates found in closure, see above. Usually this '
28+ 'happens if two packages depend on different version '
29+ 'of the same dependency.')
30+ sys.exit(1)
···57# Raise an error if two packages are installed with the same name
58# TODO: For cross we probably need a different PYTHONPATH, or not
59# add the runtime deps until after buildPhase.
60-# FIXME: disabled for Python 2 because broken
61-, catchConflicts ? false
6263# Additional arguments to pass to the makeWrapper function, which wraps
64# generated binaries.
···57# Raise an error if two packages are installed with the same name
58# TODO: For cross we probably need a different PYTHONPATH, or not
59# add the runtime deps until after buildPhase.
60+, catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform)
06162# Additional arguments to pass to the makeWrapper function, which wraps
63# generated binaries.