22Don't use this except if you have a deadline or you encounter a bug. 
33""" 
44import  re 
5+ import  sys 
6+ from  warnings  import  warn 
57
68import  setuptools 
79from  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