-
Notifications
You must be signed in to change notification settings - Fork 78
Use the default/cached value when a BuildConfig field is None #5943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
!test |
Description
|
| Relevant files | |||
|---|---|---|---|
| Bug fix |
| ||
| Enhancement |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 No relevant tests |
| ⚡ Recommended focus areas for review |
Ninja Generator Logic Error
if config.no_ninja is not None and not config.no_ninja: on line 328 is incorrect. When no_ninja is None (default), this evaluates to False, so Ninja generator is not added. However, the old code if not config.no_ninja: would add Ninja when no_ninja was None or False. This changes the default behavior - previously Ninja was used by default when no_ninja was not explicitly set to True, but now Ninja is only used when no_ninja is explicitly set to False. This could break existing builds that relied on the default Ninja generator. |
Greptile OverviewGreptile SummaryThis PR changes Major changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant setup.py
participant BuildConfig
participant utils
participant CMake
User->>setup.py: Run setup.py (pip install)
setup.py->>BuildConfig: Create BuildConfig instance
Note over BuildConfig: Fields default to None<br/>instead of False/20/"Release"
setup.py->>utils: override_build_config_from_env(config)
utils->>BuildConfig: Set fields from env vars (if present)
Note over BuildConfig: Fields remain None if env var not set
setup.py->>BuildConfig: Check cpp_standard is not None and >= 20
setup.py->>utils: run(config, version_tag, relative_path)
utils->>utils: cmake(config, relative_path)
utils->>utils: Build cmake command
loop For each BuildConfig field
alt Field is not None
utils->>utils: Add cmake option to cmd_str
else Field is None
Note over utils: Skip option, use cmake default/cached value
end
end
utils->>CMake: Execute cmake command
Note over CMake: Uses default or cached values<br/>for omitted options
CMake-->>utils: Configuration complete
utils->>CMake: Build and install
CMake-->>utils: Build complete
utils-->>setup.py: Build complete
setup.py-->>User: Installation complete
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
| if config.no_ninja is not None and not config.no_ninja: | ||
| cmd_str.append("-G") | ||
| cmd_str.append("Ninja") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the default build behavior. Previously, when no_ninja was False (the default), Ninja was used. Now, when no_ninja is None (the new default), this condition evaluates to False, so Ninja will NOT be used by default.
To maintain the previous behavior, this should be:
| if config.no_ninja is not None and not config.no_ninja: | |
| cmd_str.append("-G") | |
| cmd_str.append("Ninja") | |
| if config.no_ninja is None or not config.no_ninja: | |
| cmd_str.append("-G") | |
| cmd_str.append("Ninja") |
| if config.nvmmh_include_dir is not None: | ||
| cmd_str.append(f"-DNVMMH_INCLUDE_DIR={config.nvmmh_include_dir}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When nvmmh_include_dir is an empty string (the old default in line 31), this will now pass -DNVMMH_INCLUDE_DIR= to cmake. The previous check if config.nvmmh_include_dir: correctly avoided this. Consider using:
| if config.nvmmh_include_dir is not None: | |
| cmd_str.append(f"-DNVMMH_INCLUDE_DIR={config.nvmmh_include_dir}") | |
| if config.nvmmh_include_dir is not None and config.nvmmh_include_dir: | |
| cmd_str.append(f"-DNVMMH_INCLUDE_DIR={config.nvmmh_include_dir}") |
Fixes #5824