diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4b8b8f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Get the base Python image +FROM python:3.7 + +# Set the working directory in the container +RUN useradd -ms /bin/bash msspec +WORKDIR /code + +# Fetch the code +COPY fresh . + +ENV LANG=en_US.UTF-8 +ENV PATH=/opt/bin:$PATH + +# Install system dependencies +RUN apt-get update && \ + apt-get install -y virtualenv gfortran locales python3-wxgtk4.0 + +# Reconfigure the locales +RUN sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=$LANG + +# Install msspec +RUN make install VERBOSE=1 INSTALL_PREFIX=/opt + +#RUN echo "/usr/lib/python3/dist-packages" > /opt/src/msspec_venv_*/lib/python3.7/site-packages/system_packages.pth + +USER msspec + +ENTRYPOINT ["msspec"] diff --git a/Makefile b/Makefile index aabbbd9..b96333b 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,38 @@ include src/options.mk PYTHON = python +PYMAJ = 3 +PYMIN = 6 -# Checking Python version +# Checking Python path and version PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null) ifndef PYTHON_EXE $(error Unable to find the $(PYTHON) executable!) endif -PYTHON_VERSION_MAJOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f1) -PYTHON_VERSION_MINOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f2) - -ifneq ($(shell test $(PYTHON_VERSION_MAJOR) -ge 3 -a $(PYTHON_VERSION_MINOR) -ge 6; echo $$?),0) - $(error Python version >= 3.6 is needed!) +ifeq ($(shell $(PYTHON_EXE) -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0) + $(error Python version >= $(PYMAJ).$(PYMIN) is needed!) endif .PHONY: pybinding install devel venv doc clean -pybinding: - @+$(MAKE) -C src pybinding +pybinding: venv + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding venv: - virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) - . $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze + @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) + @. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze -install: pybinding venv - @+$(MAKE) -C src sdist - @+$(MAKE) -C src frontend - @. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz +install: pybinding + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend + @+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz + @echo "Do not forget to check that $(INSTALL_PREFIX)/bin is set in your \$$PATH" devel: VENV_PATH = ./_venv @@ -52,3 +52,7 @@ doc: clean:: @+$(MAKE) -C src/ clean + +help: + @echo "Top Makefile help message" + diff --git a/src/Makefile b/src/Makefile index d2dda44..189f6c6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,8 +16,10 @@ dist/msspec-$(VERSION).tar.gz: VERSION $(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION @echo "Installing frontend command..." - @cat $< | sed 's/__VERSION__/$(VERSION)/' > $@ - @chmod u+x $@ + @mkdir -p $(dir $@) + @cat $< | sed -e 's/__VERSION__/$(VERSION)/' -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@ + #@cat $< | sed 's/__VERSION__/$(VERSION)/' > $@ + @chmod 755 $@ pybinding: @@ -56,5 +58,5 @@ clean:: help: - @echo "help message" + @echo "SRC Makefile help message" diff --git a/src/msspec.sh.template b/src/msspec.sh.template index b6cc2ea..22ef574 100644 --- a/src/msspec.sh.template +++ b/src/msspec.sh.template @@ -3,7 +3,7 @@ SCRIPT_PATH="$0" SCRIPT_NAME=$(basename "$SCRIPT_PATH") VERSION="__VERSION__" -VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION" +VENV_PATH="__VENV_PATH__" # Check venv path if ! [ -d "$VENV_PATH" ]; then diff --git a/src/options.mk b/src/options.mk index 6e432dd..bec887b 100644 --- a/src/options.mk +++ b/src/options.mk @@ -69,6 +69,9 @@ OBJS = $(addprefix $(BUILDDIR)/, $(patsubst %.f,%.o, $(filter-out $(MAIN_F), $(S .PHONY: clean obj all info +help: + + info: @echo "Compilation information for msspec $(VERSION)" @echo "FC : $(FC)" diff --git a/src/pip.freeze b/src/pip.freeze index 49e5fc2..0a7d654 100644 --- a/src/pip.freeze +++ b/src/pip.freeze @@ -1,57 +1,14 @@ -alabaster==0.7.12 ase==3.19.1 -Babel==2.8.0 -backcall==0.1.0 -certifi==2020.4.5.1 -chardet==3.0.4 -coverage==5.1 -cycler==0.10.0 -decorator==4.4.2 -docutils==0.16 h5py==2.10.0 -idna==2.9 -imagesize==1.2.0 ipython==7.13.0 -ipython-genutils==0.2.0 -jedi==0.17.0 -Jinja2==2.11.2 lxml==4.5.0 -MarkupSafe==1.1.1 matplotlib==2.1.1 numpy==1.18.2 -packaging==20.3 -parso==0.7.0 -pex==2.1.11 -pexpect==4.8.0 -pickleshare==0.7.5 -Pillow==7.1.1 Pint==0.11 -pip==20.0.2 -prompt-toolkit==3.0.5 -ptyprocess==0.6.0 +#pip==20.0.2 pycairo==1.19.1 -Pygments==2.6.1 -pyparsing==2.4.7 -python-dateutil==2.8.1 -pytz==2019.3 -requests==2.23.0 scipy==1.4.1 -scons==3.1.2 -setuptools==46.1.3 setuptools-scm==3.5.0 -six==1.14.0 -snowballstemmer==2.0.0 -spglib==1.14.1.post0 -Sphinx==3.0.1 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==1.0.3 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.4 terminaltables==3.1.0 -traitlets==4.3.3 -urllib3==1.25.8 -wcwidth==0.1.9 -wheel==0.34.2 -#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.7.post2-cp36-cp36m-linux_x86_64.whl +#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-10/wxPython-4.1.0-cp37-cp37m-linux_x86_64.whl +#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-9/wxPython-4.0.7.post2-cp35-cp35m-linux_x86_64.whl