File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,24 @@ def _prep_env_override(self, env_parent_dir: Path) -> Path:
4141 # The project checkout.
4242 build_dir = Path (self ._build_root ) / self ._repo_subdir
4343
44+ # Older iterations of setup.py are incompatible with setuptools>=80.
45+ # (Most dependencies are protected by lock-files, but build
46+ # dependencies in pyproject.toml are independent).
47+ setup_py = build_dir / "setup.py"
48+ pyproject = build_dir / "pyproject.toml"
49+ if setup_py .is_file () and "setuptools.command.develop" in setup_py .read_text ():
50+ with pyproject .open ("r+" ) as file_write :
51+ lines = file_write .readlines ()
52+ for i , line in enumerate (lines ):
53+ if line == "requires = [\n " :
54+ next_line = lines [i + 1 ]
55+ indent = next_line [: len (next_line ) - len (next_line .lstrip ())]
56+
57+ lines .insert (i + 1 , f'{ indent } "setuptools<80",\n ' )
58+ break
59+ file_write .seek (0 )
60+ file_write .writelines (lines )
61+
4462 class Mode (enum .Enum ):
4563 """The scenarios where the correct env setup script is known."""
4664
Original file line number Diff line number Diff line change 55
66from setuptools import Command , setup
77from setuptools .command .build_py import build_py
8- from setuptools .command .develop import develop
98
109
1110class BaseCommand (Command ):
@@ -49,8 +48,7 @@ def finalize_options(self):
4948 cmd .finalize_options (self )
5049
5150 if not hasattr (self , "editable_mode" ) or self .editable_mode is None :
52- # Default to editable i.e., applicable to "std_names" and
53- # and "develop" commands.
51+ # Default to editable i.e., applicable to "std_names".
5452 self .editable_mode = True
5553
5654 def run (self ):
@@ -76,7 +74,6 @@ def run(self):
7674
7775
7876custom_commands = {
79- "develop" : custom_command (develop ),
8077 "build_py" : custom_command (build_py ),
8178 "std_names" : custom_command (BaseCommand , help = "generate CF standard names" ),
8279}
You can’t perform that action at this time.
0 commit comments