Merge pull request #377 from betatim/escape-me

[MRG] Escape environment variable when using Python string formatting
pull/385/head
Min RK 2018-08-20 16:00:55 +02:00 zatwierdzone przez GitHub
commit bf312ab13a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 28 dodań i 1 usunięć

Wyświetl plik

@ -53,7 +53,9 @@ class PythonBuildPack(CondaBuildPack):
if os.path.exists(nb_requirements_file):
assemble_scripts.append((
'${NB_USER}',
'${NB_PYTHON_PREFIX}/bin/pip install --no-cache-dir -r "{}"'.format(nb_requirements_file)
# want the $NB_PYHTON_PREFIX environment variable, not for
# Python's string formatting to try and replace this
'${{NB_PYTHON_PREFIX}}/bin/pip install --no-cache-dir -r "{}"'.format(nb_requirements_file)
))
# install requirements.txt in the kernel env

Wyświetl plik

@ -0,0 +1,2 @@
# install this in the kernel's environment, the user wants Python 2 there
numpy

Wyświetl plik

@ -0,0 +1,3 @@
# install this in the environment in which the notebook server
# is running nbgitpuller does not work with Python 2
nbgitpuller==0.6.1

Wyświetl plik

@ -0,0 +1 @@
python-2.7

Wyświetl plik

@ -0,0 +1,19 @@
#!/usr/bin/env python2
import os
import sys
print(sys.version_info)
assert sys.version_info[:2] == (2, 7)
import numpy
try:
import nbgitpuller
except ImportError:
pass
else:
raise Exception("'nbgitpuller' shouldn't have been installed from requirements3.txt")
# Python 3 is the executable used for the notebook server, this should
# have nbgitpuller installed
os.system("python3 -c 'import nbgitpuller'")