[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/57: guix: python-build-system: Import setuptools before calling `setu
From: |
Hartmut Goebel |
Subject: |
03/57: guix: python-build-system: Import setuptools before calling `setup.py'. |
Date: |
Sat, 15 Oct 2016 14:08:10 +0000 (UTC) |
htgoebel pushed a commit to branch wip-python-build-system
in repository guix.
commit 9c10ae42bcdecf47e46755cfbfbfad88ac0976a4
Author: Marius Bakke <address@hidden>
Date: Thu Sep 29 18:41:35 2016 +0100
guix: python-build-system: Import setuptools before calling `setup.py'.
This is needed for packages using "distutils" instead of "setuptools" since
the former does not understand the "--single-version-externally-managed"
flag. Also export __file__ since it will be unset when setup.py is called
from
python "exec".
* guix/build/python-build-system.scm (call-setuppy): extend "python
setup.py"
call to import setuptools, export __file__, and call setup.py from
setuptools python environment.
Co-Authored-By: Hartmut Goebel <address@hidden>
---
guix/build/python-build-system.scm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/guix/build/python-build-system.scm
b/guix/build/python-build-system.scm
index d07b83f..f16abad 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -36,13 +36,23 @@
;;
;; Code:
+(define setuptools-shim
+ ;; Run setup.py with "setuptools" being imported, which will patch
+ ;; "distutils". This is needed for packages using "distutils" instead of
+ ;; "setuptools" since the former does not understand the
+ ;; "--single-version-externally-managed" flag.
+ ;; Python code taken from pip 8.1.2 pip/utils/setuptools_build.py
+ (string-append
+ "import setuptools, tokenize;__file__='setup.py';"
+ "exec(compile(getattr(tokenize, 'open', open)(__file__).read()"
+ ".replace('\\r\\n', '\\n'), __file__, 'exec'))"))
(define (call-setuppy command params)
(if (file-exists? "setup.py")
(begin
(format #t "running \"python setup.py\" with command ~s and
parameters ~s~%"
command params)
- (zero? (apply system* "python" "setup.py" command params)))
+ (zero? (apply system* "python" "-c" setuptools-shim command params)))
(error "no setup.py found")))
(define* (build #:rest empty)
- branch wip-python-build-system created (now f73de82), Hartmut Goebel, 2016/10/15
- 01/57: gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/15
- 02/57: guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/15
- 03/57: guix: python-build-system: Import setuptools before calling `setup.py'.,
Hartmut Goebel <=
- 15/57: gnu: Remove needless inputs python-pip and python2-pip., Hartmut Goebel, 2016/10/15
- 05/57: guix: python-build-system: Add helpers for getting and setting PYTHONPATH., Hartmut Goebel, 2016/10/15
- 04/57: guix: python-build-system: Add option "#:use-setuptools?" (default true)., Hartmut Goebel, 2016/10/15
- 12/57: gnu: Remove python-setuptools and python2-setuptools from inputs (part 3), Hartmut Goebel, 2016/10/15
- 18/57: gnu: python-pytest: Propagate input "python-py"., Hartmut Goebel, 2016/10/15
- 17/57: gnu: scons: Do not use setuptools for building., Hartmut Goebel, 2016/10/15
- 07/57: guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/15
- 08/57: lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/15
- 19/57: gnu: python-pytest-cov: Use upstream options for testing., Hartmut Goebel, 2016/10/15
- 23/57: inputs -> propagated-inputs: special, Hartmut Goebel, 2016/10/15