2
2
Don't use this except if you have a deadline or you encounter a bug.
3
3
"""
4
4
import re
5
+ import sys
6
+ from warnings import warn
5
7
6
8
import setuptools
7
9
from pathlib import Path
@@ -29,8 +31,8 @@ def setup_args(config_path=Path("pyproject.toml")):
29
31
val = getattr (metadata , metadata_field , None )
30
32
if val is not None :
31
33
kwargs [st_field ] = val
32
- elif metadata_field not in {' license' }:
33
- print (f' { metadata_field } not found in { dir (metadata )} ' )
34
+ elif metadata_field not in {" license" }:
35
+ print (f" { metadata_field } not found in { dir (metadata )} " )
34
36
kwargs ["packages" ] = setuptools .find_packages (include = [metadata .name + "*" ])
35
37
if metadata .requires_dist :
36
38
kwargs ["install_requires" ] = [
@@ -52,5 +54,15 @@ def setup_args(config_path=Path("pyproject.toml")):
52
54
return kwargs
53
55
54
56
55
- # print(*[f'{p}={v!r}' for p, v in setup_args().items()], sep='\n')
56
- setuptools .setup (** setup_args ())
57
+ if __name__ == "__main__" :
58
+ if "develop" in sys .argv :
59
+ msg = (
60
+ "Please use `flit install -s` or `flit install --pth-file` "
61
+ "instead of `pip install -e`/`python setup.py develop`"
62
+ )
63
+ elif "install" in sys .argv :
64
+ msg = 'Please use `pip install "$d"` instead of `python "$d/setup.py" install`'
65
+ else :
66
+ msg = "Please use `pip ...` or `flit ...` instead of `python setup.py ...`"
67
+ warn (msg , FutureWarning )
68
+ setuptools .setup (** setup_args ())
0 commit comments