repair python

This commit is contained in:
ben0i0d 2024-10-11 09:45:04 +08:00
parent 8e14ce4561
commit 12f0f6be03
7 changed files with 283 additions and 458 deletions

View File

@ -14,307 +14,307 @@ jobs:
context: python/cpu
tags: eoelab.org:1027/${{ gitea.repository }}:py-c
SCIPY:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: scipy build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: ScienceCompute/scipy
tags: eoelab.org:1027/${{ gitea.repository }}:scipy
# SCIPY:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: scipy build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: ScienceCompute/scipy
# tags: eoelab.org:1027/${{ gitea.repository }}:scipy
PYAI_C:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: pyai-c build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: ScienceCompute/pyai/cpu
tags: eoelab.org:1027/${{ gitea.repository }}:pyai-c
# PYAI_C:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: pyai-c build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: ScienceCompute/pyai/cpu
# tags: eoelab.org:1027/${{ gitea.repository }}:pyai-c
SCRPY_C:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: scrpy-c build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: BigData/scrpy
tags: eoelab.org:1027/${{ gitea.repository }}:scrpy
# SCRPY_C:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: scrpy-c build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: BigData/scrpy
# tags: eoelab.org:1027/${{ gitea.repository }}:scrpy
SQL:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: scrpy-c build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: BigData/sql
tags: eoelab.org:1027/${{ gitea.repository }}:sql
# SQL:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: scrpy-c build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: BigData/sql
# tags: eoelab.org:1027/${{ gitea.repository }}:sql
PYSPARK:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: pyspark build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: BigData/pyspark
tags: eoelab.org:1027/${{ gitea.repository }}:pyspark
# PYSPARK:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: pyspark build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: BigData/pyspark
# tags: eoelab.org:1027/${{ gitea.repository }}:pyspark
PYFLINK:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: pyflink build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: BigData/pyflink
tags: eoelab.org:1027/${{ gitea.repository }}:pyflink
# PYFLINK:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: pyflink build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: BigData/pyflink
# tags: eoelab.org:1027/${{ gitea.repository }}:pyflink
AGDA:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
# AGDA:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
ANSIBLE:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: ansible build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/ansible
tags: eoelab.org:1027/${{ gitea.repository }}:ansible
# ANSIBLE:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: ansible build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/ansible
# tags: eoelab.org:1027/${{ gitea.repository }}:ansible
C:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: c build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/c
tags: eoelab.org:1027/${{ gitea.repository }}:c
# C:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: c build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/c
# tags: eoelab.org:1027/${{ gitea.repository }}:c
CADABRA2:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: cadabra2 build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/cadabra2
tags: eoelab.org:1027/${{ gitea.repository }}:cadabra2
# CADABRA2:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: cadabra2 build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/cadabra2
# tags: eoelab.org:1027/${{ gitea.repository }}:cadabra2
CHAPEL:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
# CHAPEL:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
CPP:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: cpp build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/cpp
tags: eoelab.org:1027/${{ gitea.repository }}:cpp
# CPP:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: cpp build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/cpp
# tags: eoelab.org:1027/${{ gitea.repository }}:cpp
JAVA:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
# JAVA:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
JS:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: js build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/js
tags: eoelab.org:1027/${{ gitea.repository }}:js
# JS:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: js build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/js
# tags: eoelab.org:1027/${{ gitea.repository }}:js
JULIA:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: julia build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/julia
tags: eoelab.org:1027/${{ gitea.repository }}:julia
# JULIA:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: julia build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/julia
# tags: eoelab.org:1027/${{ gitea.repository }}:julia
LUA:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: lua build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/lua
tags: eoelab.org:1027/${{ gitea.repository }}:lua
# LUA:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: lua build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/lua
# tags: eoelab.org:1027/${{ gitea.repository }}:lua
R:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: r build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Program/r
tags: eoelab.org:1027/${{ gitea.repository }}:r
# R:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: r build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Program/r
# tags: eoelab.org:1027/${{ gitea.repository }}:r
NOVNC:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: novnc build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Gui/novnc
tags: eoelab.org:1027/${{ gitea.repository }}:novnc
# NOVNC:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: novnc build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Gui/novnc
# tags: eoelab.org:1027/${{ gitea.repository }}:novnc
PYQT6:
runs-on: runner
needs: NOVNC
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: pyqt6 build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Gui/pyqt6
tags: eoelab.org:1027/${{ gitea.repository }}:pyqt6
# PYQT6:
# runs-on: runner
# needs: NOVNC
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: pyqt6 build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Gui/pyqt6
# tags: eoelab.org:1027/${{ gitea.repository }}:pyqt6
OCTAVE:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: octave build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/octave
tags: eoelab.org:1027/${{ gitea.repository }}:octave
# OCTAVE:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: octave build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/octave
# tags: eoelab.org:1027/${{ gitea.repository }}:octave
SAGEMATH:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: sagemath build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/sagemath
tags: eoelab.org:1027/${{ gitea.repository }}:sage
# SAGEMATH:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: sagemath build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/sagemath
# tags: eoelab.org:1027/${{ gitea.repository }}:sage
SCILAB:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: scilab build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/scilab
tags: eoelab.org:1027/${{ gitea.repository }}:scilab
# SCILAB:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: scilab build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/scilab
# tags: eoelab.org:1027/${{ gitea.repository }}:scilab
MAPLE:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: maple build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/maple
tags: eoelab.org:1027/${{ gitea.repository }}:maple
# MAPLE:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: maple build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/maple
# tags: eoelab.org:1027/${{ gitea.repository }}:maple
MMA:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: mma build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/mathematica
tags: eoelab.org:1027/${{ gitea.repository }}:mma
# MMA:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: mma build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/mathematica
# tags: eoelab.org:1027/${{ gitea.repository }}:mma
MATLAB_MINIMAL:
runs-on: runner
needs: Base
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: matlab build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/matlab/minimal
tags: eoelab.org:1027/${{ gitea.repository }}:matlab-minimal
# MATLAB_MINIMAL:
# runs-on: runner
# needs: Base
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: matlab build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/matlab/minimal
# tags: eoelab.org:1027/${{ gitea.repository }}:matlab-minimal
MATLAB_MCM:
runs-on: runner
needs: MATLAB_MINIMAL
steps:
- name: checkout code
uses: https://eoelab.org:1027/actions/checkout@v4
- name: matlab-mcm build
uses: https://eoelab.org:1027/actions/build-push-action@v6
with:
context: Math/matlab/mcm
tags: eoelab.org:1027/${{ gitea.repository }}:matlab-mcm
# MATLAB_MCM:
# runs-on: runner
# needs: MATLAB_MINIMAL
# steps:
# - name: checkout code
# uses: https://eoelab.org:1027/actions/checkout@v4
# - name: matlab-mcm build
# uses: https://eoelab.org:1027/actions/build-push-action@v6
# with:
# context: Math/matlab/mcm
# tags: eoelab.org:1027/${{ gitea.repository }}:matlab-mcm
Push:
runs-on: runner
needs: [OCTAVE] #MATLAB_MCM, MAPLE, MMA
needs: [Base] #MATLAB_MCM, MAPLE, MMA
steps:
- name: login gitea_registry
uses: https://eoelab.org:1027/actions/login-action@v3

View File

@ -9,28 +9,31 @@ ENV DEBIAN_FRONTEND=noninteractive \
NB_USER=jovyan \
NB_UID=1000 \
NB_GID=100 \
SHELL=/bin/bash \
PATH="/opt/base/bin:${PATH}" \
HOME="/home/jovyan"
# Copy files
COPY conf/profile /etc/
COPY start-sh/* /usr/local/bin/
COPY conf/jupyter_server_config.py /etc/jupyter/
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
# install base packages
apt-get update --yes && apt-get install --yes --no-install-recommends sudo tini unzip python3-venv && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
chmod a+rx /usr/local/bin/* && \
# Create user , set password and add to sudoers
useradd -l -m -s /bin/bash -N -u "${NB_UID}" "${NB_USER}" && \
usermod -aG sudo "${NB_USER}" && echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
chmod g+w /etc/passwd && \
# Create dirs for startup hooks
mkdir /usr/local/bin/start-notebook.d && mkdir /usr/local/bin/before-notebook.d && \
# setup base venv & pip_mirror
mkdir -p "/opt/base/" && python3 -m venv /opt/base && chown -hR "${NB_USER}:${NB_GID}" "/opt/base" && \
echo '[global]\nindex-url = https://mirrors.bfsu.edu.cn/pypi/web/simple' > /etc/pip.conf
USER ${NB_UID}
# install jupyter python mamba extension
# install jupyter extension
RUN pip install 'jupyterlab' 'jupyterhub' && \
pip install jupyterlab-language-pack-zh-CN jupyterlab_tabnine && \
pip cache purge

View File

@ -1,61 +0,0 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# mypy: ignore-errors
import os
import stat
import subprocess
from pathlib import Path
from jupyter_core.paths import jupyter_data_dir
c = get_config() # noqa: F821
c.ServerApp.ip = "0.0.0.0"
c.ServerApp.open_browser = False
# to output both image/svg+xml and application/pdf plot formats in the notebook file
c.InlineBackend.figure_formats = {"png", "jpeg", "svg", "pdf"}
# https://github.com/jupyter/notebook/issues/3130
c.FileContentsManager.delete_to_trash = False
# config hide file
c.FileContentsManager.hide_globs=[]
# Generate a self-signed certificate
OPENSSL_CONFIG = """\
[req]
distinguished_name = req_distinguished_name
[req_distinguished_name]
"""
if "GEN_CERT" in os.environ:
dir_name = Path(jupyter_data_dir())
dir_name.mkdir(parents=True, exist_ok=True)
pem_file = dir_name / "notebook.pem"
# Generate an openssl.cnf file to set the distinguished name
cnf_file = Path(os.getenv("CONDA_DIR", "/usr/lib")) / "ssl/openssl.cnf"
if not cnf_file.exists():
cnf_file.write_text(OPENSSL_CONFIG)
# Generate a certificate if one doesn't exist on disk
subprocess.check_call(
[
"openssl",
"req",
"-new",
"-newkey=rsa:2048",
"-days=365",
"-nodes",
"-x509",
"-subj=/C=XX/ST=XX/L=XX/O=generated/CN=generated",
f"-keyout={pem_file}",
f"-out={pem_file}",
]
)
# Restrict access to the file
pem_file.chmod(stat.S_IRUSR | stat.S_IWUSR)
c.ServerApp.certfile = str(pem_file)
# Change default umask for all subprocesses of the Server if set in the environment
if "NB_UMASK" in os.environ:
os.umask(int(os.environ["NB_UMASK"], 8))

View File

@ -1,29 +0,0 @@
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
# del the PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "$(id -u)" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi

View File

@ -13,24 +13,26 @@ ENV DEBIAN_FRONTEND=noninteractive \
HOME="/home/jovyan"
# Copy files
COPY conf/profile /etc/
COPY start-sh/* /usr/local/bin/
COPY conf/jupyter_server_config.py /etc/jupyter/
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
# install base packages
apt-get update --yes && apt-get install --yes --no-install-recommends sudo tini unzip python3-venv && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
chmod a+rx /usr/local/bin/* && \
# Create user , set password and add to sudoers
useradd -l -m -s /bin/bash -N -u "${NB_UID}" "${NB_USER}" && \
usermod -aG sudo "${NB_USER}" && echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
chmod g+w /etc/passwd && \
# Create dirs for startup hooks
mkdir /usr/local/bin/start-notebook.d && mkdir /usr/local/bin/before-notebook.d && \
# setup base venv & pip_mirror
mkdir -p "/opt/base/" && python3 -m venv /opt/base && chown -hR "${NB_USER}:${NB_GID}" "/opt/base" && \
echo '[global]\nindex-url = https://mirrors.bfsu.edu.cn/pypi/web/simple' > /etc/pip.conf
USER ${NB_UID}
# install jupyter python mamba extension
# install jupyter extension
RUN pip install 'jupyterlab' 'jupyterhub' && \
pip install jupyterlab-language-pack-zh-CN jupyterlab_tabnine && \
pip cache purge

View File

@ -1,61 +0,0 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# mypy: ignore-errors
import os
import stat
import subprocess
from pathlib import Path
from jupyter_core.paths import jupyter_data_dir
c = get_config() # noqa: F821
c.ServerApp.ip = "0.0.0.0"
c.ServerApp.open_browser = False
# to output both image/svg+xml and application/pdf plot formats in the notebook file
c.InlineBackend.figure_formats = {"png", "jpeg", "svg", "pdf"}
# https://github.com/jupyter/notebook/issues/3130
c.FileContentsManager.delete_to_trash = False
# config hide file
c.FileContentsManager.hide_globs=['__pycache__']
# Generate a self-signed certificate
OPENSSL_CONFIG = """\
[req]
distinguished_name = req_distinguished_name
[req_distinguished_name]
"""
if "GEN_CERT" in os.environ:
dir_name = Path(jupyter_data_dir())
dir_name.mkdir(parents=True, exist_ok=True)
pem_file = dir_name / "notebook.pem"
# Generate an openssl.cnf file to set the distinguished name
cnf_file = Path(os.getenv("CONDA_DIR", "/usr/lib")) / "ssl/openssl.cnf"
if not cnf_file.exists():
cnf_file.write_text(OPENSSL_CONFIG)
# Generate a certificate if one doesn't exist on disk
subprocess.check_call(
[
"openssl",
"req",
"-new",
"-newkey=rsa:2048",
"-days=365",
"-nodes",
"-x509",
"-subj=/C=XX/ST=XX/L=XX/O=generated/CN=generated",
f"-keyout={pem_file}",
f"-out={pem_file}",
]
)
# Restrict access to the file
pem_file.chmod(stat.S_IRUSR | stat.S_IWUSR)
c.ServerApp.certfile = str(pem_file)
# Change default umask for all subprocesses of the Server if set in the environment
if "NB_UMASK" in os.environ:
os.umask(int(os.environ["NB_UMASK"], 8))

View File

@ -1,29 +0,0 @@
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
# del the PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "$(id -u)" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi