@@ -26,11 +26,11 @@ def _meson_cli():
26
26
return [meson_cli ]
27
27
28
28
29
- def _editable_install_path (package ):
29
+ def _editable_install_path (distname ):
30
30
import importlib_metadata
31
31
32
32
try :
33
- dist = importlib_metadata .Distribution .from_name (package )
33
+ dist = importlib_metadata .Distribution .from_name (distname )
34
34
except importlib_metadata .PackageNotFoundError :
35
35
return None
36
36
@@ -43,13 +43,13 @@ def _editable_install_path(package):
43
43
return None
44
44
45
45
46
- def _is_editable_install (package ):
47
- return _editable_install_path (package ) is not None
46
+ def _is_editable_install (distname ):
47
+ return _editable_install_path (distname ) is not None
48
48
49
49
50
- def _is_editable_install_of_same_source (package ):
51
- editable_path = _editable_install_path (package )
52
- return editable_path and os .path .samefile (_editable_install_path (package ), "." )
50
+ def _is_editable_install_of_same_source (distname ):
51
+ editable_path = _editable_install_path (distname )
52
+ return editable_path and os .path .samefile (_editable_install_path (distname ), "." )
53
53
54
54
55
55
def _set_pythonpath (quiet = False ):
@@ -63,10 +63,10 @@ def _set_pythonpath(quiet=False):
63
63
env = os .environ
64
64
65
65
cfg = get_config ()
66
- package = cfg .get ("tool.spin.package " , None )
67
- if package :
68
- if _is_editable_install (package ):
69
- if _is_editable_install_of_same_source (package ):
66
+ distname = cfg .get ("project.name " , None )
67
+ if distname :
68
+ if _is_editable_install (distname ):
69
+ if _is_editable_install_of_same_source (distname ):
70
70
if not (quiet ):
71
71
click .secho (
72
72
"Editable install of same source directory detected; not setting PYTHONPATH" ,
@@ -76,12 +76,12 @@ def _set_pythonpath(quiet=False):
76
76
else :
77
77
# Ignoring the quiet flag, because picking up the wrong package is problematic
78
78
click .secho (
79
- f"Warning! Editable install of `{ package } `, from a different source location, detected." ,
79
+ f"Warning! Editable install of `{ distname } `, from a different source location, detected." ,
80
80
fg = "bright_red" ,
81
81
)
82
82
click .secho ("Spin commands will pick up that version." , fg = "bright_red" )
83
83
click .secho (
84
- f"Try removing the other installation by switching to its source and running `pip uninstall { package } `." ,
84
+ f"Try removing the other installation by switching to its source and running `pip uninstall { distname } `." ,
85
85
fg = "bright_red" ,
86
86
)
87
87
@@ -101,8 +101,8 @@ def _set_pythonpath(quiet=False):
101
101
def _get_site_packages ():
102
102
try :
103
103
cfg = get_config ()
104
- package = cfg .get ("tool.spin.package " , None )
105
- if _is_editable_install_of_same_source (package ):
104
+ distname = cfg .get ("project.name " , None )
105
+ if _is_editable_install_of_same_source (distname ):
106
106
return ""
107
107
except RuntimeError :
108
108
# Probably not running in click
@@ -188,8 +188,8 @@ def build(meson_args, jobs=None, clean=False, verbose=False, quiet=False):
188
188
CFLAGS="-O0 -g" spin build
189
189
"""
190
190
cfg = get_config ()
191
- package = cfg .get ("tool.spin.package " , None )
192
- if package and _is_editable_install_of_same_source (package ):
191
+ distname = cfg .get ("project.name " , None )
192
+ if distname and _is_editable_install_of_same_source (distname ):
193
193
if not quiet :
194
194
click .secho (
195
195
"Editable install of same source detected; skipping build" ,
0 commit comments