Conversation
Port the 7 scripts/build/*.pl scripts that have no dependency on perl/Galacticus/Build/* modules to Python equivalents: - includeDependencies.py - findExecutables.py - staticRelinker.py - libraryDependencies.py - libraryInterfacesDependencies.py - enumerateOpenMPCriticalSections.py - postprocess.py Also introduce python/build/ as a new subpackage on PYTHONPATH, with fortran_utils.py providing get_fortran_line() (replacing the Perl Fortran::Utils::Get_Fortran_Line function) for use by the two scripts that need Fortran source parsing. https://claude.ai/code/session_01WA7SHaciLZJ1S7Nof1KU1f
…scripts in build infrastructure
There was a problem hiding this comment.
Pull request overview
Ports Galacticus build scripts from Perl to Python 3 to modernize the build pipeline while preserving existing behavior and outputs.
Changes:
- Added Python 3 replacements for multiple build helper scripts (postprocess, dependency generation, static relinking, OpenMP critical section enumeration).
- Updated Makefile, CI workflow, and developer docs to invoke the new
.pyscripts. - Introduced a shared Python Fortran parsing utility module (
fortran_utils.py).
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/build/staticRelinker.py | Python replacement for macOS static relinking helper. |
| scripts/build/staticRelinker.pl | Removed Perl implementation. |
| scripts/build/postprocess.py | Python replacement for compiler output post-processing and line remapping. |
| scripts/build/postprocess.pl | Removed Perl implementation. |
| scripts/build/libraryInterfacesDependencies.py | Python generator for libgalacticus Makefile dependency rules. |
| scripts/build/libraryInterfacesDependencies.pl | Removed Perl implementation. |
| scripts/build/libraryDependencies.py | Python replacement for link library resolution and ordering. |
| scripts/build/libraryDependencies.pl | Removed Perl implementation. |
| scripts/build/includeDependencies.py | Python generator for include-file dependency Makefile rules. |
| scripts/build/includeDependencies.pl | Removed Perl implementation. |
| scripts/build/findExecutables.py | Python executable discovery + Makefile rule generation. |
| scripts/build/findExecutables.pl | Removed Perl implementation. |
| scripts/build/enumerateOpenMPCriticalSections.py | Python OpenMP critical section enumerator + outputs. |
| scripts/build/enumerateOpenMPCriticalSections.pl | Removed Perl implementation. |
| python/build/fortran_utils.py | New shared Fortran logical-line parsing utility. |
| doc/Development.tex | Documentation updates to reference .py scripts (plus one index entry issue). |
| Makefile | Switched build rules from Perl to Python scripts. |
| .github/workflows/cicd.yml | CI updated to run Python static relinker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: Add error handling as suggested by Copilot. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…void problems with file names containing spaces or other problematic characters
Spell check warnings (click to expand)
|
Ensures that `$(BUILDPATH)/libgalacticus` is built before it needs to be scanned for module import dependencies.
Spell check warnings (click to expand)
|
This is important as double slash, `//`, can lead to file name/dependency mismatches, breaking the build.
Spell check warnings (click to expand)
|
Spell check warnings (click to expand)
|
This avoids converting, for example, `-lgslcblas` to `/usr/local/lib/libgsl.acblas`.
Spell check warnings (click to expand)
|
This PR ports the Galacticus build system scripts from Perl to Python 3, modernizing the build infrastructure while maintaining functional equivalence.
Summary
All build-related Perl scripts have been converted to Python 3 equivalents. This includes compiler output post-processing, library dependency resolution, static relinking on macOS, include file dependency tracking, OpenMP critical section enumeration, and executable discovery. A new shared Fortran parsing utility module has been created to support these scripts.
Key Changes
postprocess.pl- remaps line numbers in preprocessed files to original sources and filters compiler warningslibraryDependencies.pl- determines required libraries for linking executables using topological sortingstaticRelinker.pl- converts dynamic library links to static equivalents on macOSincludeDependencies.pl- generates Makefile rules for include file dependenciesenumerateOpenMPCriticalSections.pl- enumerates OpenMP critical sections for instrumentationfindExecutables.pl- discovers Fortran program files and generates executable build ruleslibraryInterfacesDependencies.pl- builds Makefile dependencies for libgalacticusImplementation Details
sys.stdout.isatty()instead of Perl's Term::ANSIColor.pyscripts instead of.plequivalentshttps://claude.ai/code/session_01WA7SHaciLZJ1S7Nof1KU1f