Skip to content

Commit 00f4370

Browse files
committed
Add warning
1 parent 1d871a7 commit 00f4370

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

setup.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Don't use this except if you have a deadline or you encounter a bug.
33
"""
44
import re
5+
import sys
6+
from warnings import warn
57

68
import setuptools
79
from pathlib import Path
@@ -29,8 +31,8 @@ def setup_args(config_path=Path("pyproject.toml")):
2931
val = getattr(metadata, metadata_field, None)
3032
if val is not None:
3133
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)}")
3436
kwargs["packages"] = setuptools.find_packages(include=[metadata.name + "*"])
3537
if metadata.requires_dist:
3638
kwargs["install_requires"] = [
@@ -52,5 +54,15 @@ def setup_args(config_path=Path("pyproject.toml")):
5254
return kwargs
5355

5456

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

Comments
 (0)