diff --git a/.copier-answers.yml b/.copier-answers.yml index 3e3d361..f3bd003 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,6 @@ # Changes here will be overwritten by Copier _commit: 81e8acd -_src_path: git@github.com:python-project-templates/base.git +_src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com github: python-project-templates diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9a8ac7..b5df3cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,8 +29,8 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] - python-version: ["3.9"] + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -56,7 +56,15 @@ jobs: - name: Test run: make coverage - + if: matrix.os != 'windows-latest' + + - name: Test + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + make coverage + shell: cmd + if: matrix.os == 'windows-latest' + - name: Upload test results (Python) uses: actions/upload-artifact@v4 with: @@ -68,7 +76,7 @@ jobs: uses: EnricoMi/publish-unit-test-result-action@v2 with: files: '**/junit.xml' - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' - name: Upload coverage uses: codecov/codecov-action@v5 @@ -82,4 +90,4 @@ jobs: with: name: dist-${{matrix.os}} path: dist - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' diff --git a/Makefile b/Makefile index 627b57c..1473fb6 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ deep-clean: ## clean everything from the repository git clean -fdx clean: ## clean the repository - rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info + rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info hatch_cpp/tests/*/dist hatch_cpp/tests/*/build hatch_cpp/tests/*/*/*.so hatch_cpp/tests/*/*/*.pyd ############################################################################################ diff --git a/hatch_cpp/plugin.py b/hatch_cpp/plugin.py index fb88301..0ce6f53 100644 --- a/hatch_cpp/plugin.py +++ b/hatch_cpp/plugin.py @@ -43,10 +43,13 @@ def initialize(self, version: str, _: dict[str, t.Any]) -> None: libraries = [HatchCppLibrary(**library_kwargs) for library_kwargs in library_kwargs] platform = HatchCppPlatform.default() if config.toolchain == "raw": - # g++ basic-project/basic.cpp -I. -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/ -undefined dynamic_lookup -fPIC -shared -o extension.so build_plan = HatchCppBuildPlan(libraries=libraries, platform=platform) build_plan.generate() - build_plan.execute(verbose=config.verbose) + if config.verbose: + for command in build_plan.commands: + self._logger.info(command) + build_plan.execute() + # build_kwargs = config.build_kwargs # if version == "editable": # build_kwargs = config.editable_build_kwargs or build_kwargs diff --git a/hatch_cpp/structs.py b/hatch_cpp/structs.py index ccfab16..0412aef 100644 --- a/hatch_cpp/structs.py +++ b/hatch_cpp/structs.py @@ -117,8 +117,7 @@ def get_flags(self, library: HatchCppLibrary) -> str: flags += " " + " ".join(f"/LIBPATH:{lib}" for lib in library.library_dirs) flags += " " + " ".join(f"/D{macro}" for macro in library.define_macros) flags += " " + " ".join(f"/U{macro}" for macro in library.undef_macros) - flags += f" /Fo{library.name}.obj" - flags += f" /Fe{library.name}.pyd" + flags += f" /Fo{library.name}.pyd" # clean while flags.count(" "): flags = flags.replace(" ", " ") @@ -138,9 +137,7 @@ def generate(self): self.commands.append(f"{self.platform.cc} {' '.join(library.sources)} {flags}") return self.commands - def execute(self, verbose: bool = True): + def execute(self): for command in self.commands: - if verbose: - print(f"Running command: {command}") system(command) return self.commands