Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching setup.py for installation without pip for Spack #63

Merged
merged 21 commits into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d7c9033
patching setup.py for installation without pip
ajaust Oct 28, 2020
5b35c3c
importing version from packaging
ajaust Oct 28, 2020
b72f5cc
show warning
ajaust Oct 28, 2020
2a4ef42
Warn, if pip is not used
BenjaminRodenberg Oct 28, 2020
22a3f51
Improve readability and check uses_pip, before warnings
BenjaminRodenberg Nov 6, 2020
e4ebfd8
Require pip >= 19.0.0, if installed via pip.
BenjaminRodenberg Nov 6, 2020
28ff859
Update documentation. pip3 19.0.0 is minimum requirement. Remove trou…
BenjaminRodenberg Nov 6, 2020
f6f6522
Make command in Exception consistent with README.md
BenjaminRodenberg Nov 6, 2020
7450a2a
Fix formatting.
BenjaminRodenberg Nov 6, 2020
8fd7854
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 6, 2020
e1dfc03
Don't use bare except.
BenjaminRodenberg Nov 6, 2020
bc83654
Move imports to top and cleanup.
BenjaminRodenberg Nov 6, 2020
6bbdd81
Change order to reduce diff.
BenjaminRodenberg Nov 6, 2020
0195020
Fix formatting w.r.t blank lines.
BenjaminRodenberg Nov 6, 2020
73451b8
Make packaging optional for warnings, add note on https://github.com/…
BenjaminRodenberg Nov 20, 2020
e194d15
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
1075d00
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
687fbc4
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
2b0c86f
Update CHANGELOG.md
BenjaminRodenberg Nov 20, 2020
233dc29
Merge branch 'develop' into ajaust_develop
BenjaminRodenberg Nov 20, 2020
9e2ba2a
Update setup.py
BenjaminRodenberg Nov 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
# PEP 518 - minimum build system requirements
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip", "numpy"]
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy"]
22 changes: 15 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import warnings
warnings.warn("deprecated", RuntimeWarning)
uses_pip = "pip" in __file__
if not uses_pip: # check whether pip is used for installation. If pip is not used, dependencies defined in pyproject.toml might be missing.
warnings.warn("It looks like you are not using pip for installation. Installing the package via 'pip3 install --user .' is recommended. You can still use 'python3 setup.py install --user', if you want and if the bindings work correctly, you do not have to worry. However, if you face problems during installation or running pyprecice, this means that you have to make sure that all dependencies are installed correctly and repeat the installation of pyprecice. Refer to pyproject.toml for a list of dependencies.")

import os
import subprocess
import warnings
from packaging import version
import pip

if version.parse(pip.__version__) < version.parse("19.0"):
# version 19.0 is required, since we are using pyproject.toml for definition of build-time depdendencies. See https://pip.pypa.io/en/stable/news/#id209
warnings.warn("You are using pip version {}. However, pip version > 19.0 is recommended. You can continue with the installation, but installation problems can occour. Please refer to https://github.com/precice/python-bindings#build-time-dependencies-cython-numpy-defined-in-pyprojecttoml-are-not-installed-automatically for help.".format(pip.__version__))
if uses_pip:
# If installed with pip we need to check its version
try:
import pip
if version.parse(pip.__version__) < version.parse("19.0"):
# version 19.0 is required, since we are using pyproject.toml for definition of build-time depdendencies. See https://pip.pypa.io/en/stable/news/#id209
raise Exception("You are using pip version {}. However, pip version >= 19.0 is required. Please upgrade your pip installation via 'python3 -m pip install --upgrade pip'. You might have to add the --user flag.".format(pip.__version__))
except:
raise Exception("It looks like you are trying to use pip for installation of the package, but pip is not installed on your system (or cannot be found). This can lead to problems with missing dependencies. Please make sure that pip is discoverable. Try python3 -c 'import pip'. Alternatively, you can also run python3 setup.py install --user.")

if version.parse(pip.__version__) < version.parse("10.0.1"):
warnings.warn("You are using pip version {}. However, pip version > 10.0.1 is required. If you continue with installation it is likely that you will face an error. See https://github.com/precice/python-bindings#version-of-pip3-is-too-old".format(pip.__version__))

from enum import Enum
from setuptools import setup
Expand Down