aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/aux-files/python/sitecustomize.py
blob: e2348e0356f86ad8edbcfd3d7c04e1631e28b50e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
# GNU Guix --- Functional package management for GNU
# Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

import os
import site
import sys

# Commentary:
#
# Site-specific customization for Guix.
#
# The program below honors the GUIX_PYTHONPATH environment variable to
# discover Python packages.  File names appearing in this variable that match
# a predefined versioned installation prefix are added to the sys.path.  To be
# considered, a Python package must be installed under the
# 'lib/pythonX.Y/site-packages' directory, where X and Y are the major and
# minor version numbers of the Python interpreter.
#
# Code:

major_minor = '{}.{}'.format(*sys.version_info)
site_packages_prefix = os.path.join(
    'lib', 'python' + major_minor, 'site-packages')
python_site = os.path.join(sys.prefix, site_packages_prefix)

try:
    all_sites_raw = os.environ['GUIX_PYTHONPATH'].split(os.path.pathsep)
except KeyError:
    all_sites_raw = []
# Normalize paths, otherwise a trailing slash would cause it to not match.
all_sites_norm = [os.path.normpath(p) for p in all_sites_raw]
matching_sites = [p for p in all_sites_norm
                  if p.endswith(site_packages_prefix)]

if matching_sites:
    # Deduplicate the entries, append them to sys.path, and handle any
    # .pth files they contain.
    for s in matching_sites:
        site.addsitedir(s)

    # Move the entries that were appended to sys.path in front of
    # Python's own site-packages directory.  This enables Guix
    # packages to override Python's bundled packages, such as 'pip'.
    python_site_index = sys.path.index(python_site)
    new_site_start_index = sys.path.index(matching_sites[0])
    if python_site_index < new_site_start_index:
        sys.path = (sys.path[:python_site_index]
                    + sys.path[new_site_start_index:]
                    + sys.path[python_site_index:new_site_start_index])
ltip'>Some parts of Boost which are used by other Guix packages require C++14 support. Fixes <https://bugs.gnu.org/33605>. * gnu/packages/boost.scm (boost)[arguments]: Pass 'cxxflags=-std=c++14' to #:make-flags. Leo Famulari 2018-11-25gnu: mdds: Update to 1.4.3....* gnu/packages/boost.scm (mdds): Update to 1.4.3. Marius Bakke 2018-10-17gnu: boost-for-mysql: Remove unnecessary phase....* gnu/packages/boost.scm (boost-for-mysql)[arguments]: Remove custom 'provide-libboost_python phase. Add removed '/bin/sh' substitution. Efraim Flashner 2018-08-25Merge branch 'staging' into core-updatesMarius Bakke 2018-08-24gnu: boost: Move 1.59.0 definition to boost.scm....Fixes a regression introduced in commit 7cbf06d8c2935abfc6c688cf3f9b99e0e5393960 where the top-level code of these two modules would depend on each other, leading to "boost: unbound variable" kind of errors in some circumstances. * gnu/packages/databases.scm (boost-for-mysql): Move to... * gnu/packages/boost.scm (boost-for-mysql): ... here. Make public and add 'properties' field. Ludovic Courtès 2018-08-23gnu: boost: Update to 1.68.0....* gnu/packages/boost.scm (boost): Update to 1.68.0. [arguments]: Remove /bin/sh substitution. Marius Bakke 2018-08-23gnu: boost: Provide libboost_python compatibility symlink....* gnu/packages/boost.scm (boost)[arguments]: Add phase 'provide-libboost_python'. Marius Bakke 2018-06-06Merge branch 'origin/core-updates-next' into core-updatesRicardo Wurmus 2018-05-25gnu: boost: Re-enable context and coroutine libraries on MIPS....* gnu/packages/boost.scm (boost)[arguments]: Remove the extra make-flags "--without-context", "--without-coroutine", and "--without-coroutine2" that were previously added on mips64 systems. Mark H Weaver 2018-05-06Merge branch 'master' into core-updatesMarius Bakke 2018-05-01gnu: Use HTTPS for www.boost.org....* gnu/packages/bioinformatics.scm (libgff)[license]: Use HTTPS. * gnu/packages/boost.scm (boost-sync)[license]: Likewise. (boost)[license]: Likewise. [home-page]: Likewise, and use canonical ‘www’ subdomain. Tobias Geerinckx-Rice 2018-05-01gnu: boost: Update to 1.67.0....* gnu/packages/boost.scm (boost): Update to 1.67.0. Tobias Geerinckx-Rice 2018-04-10gnu: boost: Fix ICU support....* gnu/packages/patches/boost-fix-icu-build.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/boost.scm (boost)[source]: Add the patch. [arguments]: In the custom configure phase, pass --with-icu=[...] to ./bootstrap.sh Mark H Weaver 2018-03-29Merge branch 'master' into core-updatesMarius Bakke 2018-03-22gnu: Add boost-sync....* gnu/packages/boost.scm (boost-sync): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer 2018-03-18gnu: boost: Simplify phases....* gnu/packages/boost.scm (boost)[arguments]: Remove unneeded '#t's from 'configure', 'build', and 'install' phases. Mark H Weaver 2018-03-15gnu: Remove boost-1.66....* gnu/packages/boost.scm (boost-1.66): Remove variable. * gnu/packages/storage.scm (ceph)[inputs]: Replace boost-1.66 with boost. Ricardo Wurmus 2018-03-15gnu: boost: Remove bootstrap phase....* gnu/packages/boost.scm (boost)[arguments]: Remove bootstrap phase. Ricardo Wurmus 2018-03-14Merge branch 'master' into core-updatesRicardo Wurmus