diff --git a/.github/workflows/ci-ifcopenshell-conda-daily.yml b/.github/workflows/ci-ifcopenshell-conda-daily.yml index bad86bf2aa..79c538af24 100644 --- a/.github/workflows/ci-ifcopenshell-conda-daily.yml +++ b/.github/workflows/ci-ifcopenshell-conda-daily.yml @@ -39,7 +39,7 @@ jobs: test: - name: ${{ matrix.platform.distver }}-${{ matrix.pyver.name }}-${{ matrix.variant }} + name: ${{ matrix.platform.distver }}-${{ matrix.pyver.name }} needs: activate runs-on: ${{ matrix.platform.distver }} defaults: @@ -48,9 +48,7 @@ jobs: strategy: fail-fast: false matrix: - variant: [novtk, all] pyver: [ -# { name: py311, distver: '3.11'}, { name: py312, distver: '3.12'} ] platform: [ @@ -74,13 +72,13 @@ jobs: run: | curl -L https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.13.sdk.tar.xz | tar -xvJf - -C /Users/runner/work/ - - uses: mamba-org/setup-micromamba@v1 # https://github.com/mamba-org/setup-micromamba + - uses: mamba-org/setup-micromamba@v2 # https://github.com/mamba-org/setup-micromamba with: environment-name: test-env create-args: >- - python=3.11 + python=3.12 anaconda-client - boa + rattler-build - name: create conda package dist dir run: | @@ -88,17 +86,16 @@ jobs: - name: build & test ifcopenshell run: | - conda mambabuild . --python ${{ matrix.pyver.distver }} --no-remove-work-dir --output-folder '${{ github.workspace }}/dist' --variants='{variant: ${{ matrix.variant }}}' - working-directory: ./conda + rattler-build build -r conda/recipe.yaml --python ${{ matrix.pyver.distver }} --output-folder '${{ github.workspace }}/dist' env: VERSION_OVERRIDE: ${{ needs.activate.outputs.verdate }} - name: upload to anaconda if: ${{ matrix.platform.name == 'win' }} run: | - anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --force --user ifcopenshell '${{ github.workspace }}/dist/${{ matrix.platform.pkg_dir }}/*.tar.bz2' + anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --force --user ifcopenshell '${{ github.workspace }}/dist/${{ matrix.platform.pkg_dir }}/*.conda' - name: upload to anaconda if: ${{ matrix.platform.name != 'win' }} run: | - anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --force --user ifcopenshell ${{ github.workspace }}/dist/${{ matrix.platform.pkg_dir }}/*.tar.bz2 + anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --force --user ifcopenshell ${{ github.workspace }}/dist/${{ matrix.platform.pkg_dir }}/*.conda diff --git a/conda/bld.bat b/conda/build.bat similarity index 94% rename from conda/bld.bat rename to conda/build.bat index 07e546052d..2d2a2d734f 100644 --- a/conda/bld.bat +++ b/conda/build.bat @@ -49,3 +49,7 @@ if errorlevel 1 exit 1 ninja install -j 1 if errorlevel 1 exit 1 + +python %RECIPE_DIR%/update_version_init.py %PKG_VERSION% %SP_DIR%/ifcopenshell/__init__.py + +if errorlevel 1 exit 1 \ No newline at end of file diff --git a/conda/build.sh b/conda/build.sh index c0d447a6f4..cd7ab0f5cf 100644 --- a/conda/build.sh +++ b/conda/build.sh @@ -46,4 +46,6 @@ cmake ${CMAKE_ARGS} -G Ninja \ ninja -ninja install -j 1 \ No newline at end of file +ninja install -j 1 + +python "${RECIPE_DIR}/update_version_init.py" "${PKG_VERSION}" "${SP_DIR}/ifcopenshell/__init__.py" \ No newline at end of file diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml index 2b600d14be..1f60daec48 100644 --- a/conda/conda_build_config.yaml +++ b/conda/conda_build_config.yaml @@ -1,7 +1,3 @@ -variant: - - novtk - - all - occt: - 7.8.1 @@ -27,9 +23,9 @@ c_stdlib_version: - '2.12' # [linux] - '10.13' # [osx] hdf5: -- 1.14.3 +- 1.14.6 libboost_devel: -- '1.84' +- '1.86' libxml2: - '2' mpfr: diff --git a/conda/meta.yaml b/conda/recipe.yaml similarity index 86% rename from conda/meta.yaml rename to conda/recipe.yaml index 53ad90be3f..aeddedbe07 100644 --- a/conda/meta.yaml +++ b/conda/recipe.yaml @@ -1,64 +1,78 @@ -{% set version = environ.get('VERSION_OVERRIDE', '0.8.0') %} -{% set build = 0 %} - -# Higher number -> Always prioritize "novtk" variant over "all" variant -{% set build = build + 200 %} # [variant == "novtk"] -{% set build = build + 100 %} # [variant == "all"] +context: + version: ${{ env.get("VERSION_OVERRIDE", default="0.8.2.1") }} + build: 1 package: name: ifcopenshell - version: {{ version }} + version: ${{ version }} source: - path: ../ + - path: .. build: - number: {{ build }} - skip: true # [py<39] - binary_relocation: false # [osx] - string: py{{ CONDA_PY }}_{{ variant }}_h{{ PKG_HASH }}_{{ build }} - run_exports: - - {{ pin_subpackage('ifcopenshell', max_pin='x.x.x') }} *{{ variant }}* - + number: ${{ build }} + dynamic_linking: + binary_relocation: ${{ true if osx }} requirements: build: - - cmake + - if: build_platform != target_platform + then: + - python + - cross-python_${{ target_platform }} + - cmake <4 - ninja - swig >=4.1.1 - - {{ stdlib("c") }} - - {{ compiler('c') }} - - {{ compiler('cxx') }} + - ${{ stdlib("c") }} + - ${{ compiler('c') }} + - ${{ compiler('cxx') }} host: - python - libboost-devel - - occt *=*{{ variant }}* + - occt - libxml2 - cgal-cpp - hdf5 - eigen - mpfr - nlohmann_json - - gmp # [unix] - - mpir # [win] + - gmp - zlib run: - python - - {{ pin_compatible('occt', max_pin='x.x.x') }} *{{ variant }}* - - {{ pin_compatible('cgal-cpp', max_pin='x.x') }} - - -test: - imports: - - ifcopenshell + - shapely + - typing_extensions + - ${{ pin_compatible('occt', upper_bound='x.x.x') }} + - ${{ pin_compatible('cgal-cpp', upper_bound='x.x') }} + run_exports: + - ${{ pin_subpackage('ifcopenshell', upper_bound='x.x.x') }} +tests: + - python: + imports: + - ifcopenshell + pip_check: false + - script: + - python -c "import ifcopenshell; assert ifcopenshell.version == '${{ version }}', 'print(ifcopenshell.version)'" + requirements: + run: + - occt * *novtk* # Ensure that even though compiled against OCCT with VTK, it can still run with OCCT without VTK + - pytest + - python-dateutil + - xmlschema + - xsdata + - lxml + - isodate + - lark + - networkx + - tabulate + - shapely about: - home: https://ifcopenshell.org license: LGPL-3.0-or-later license_file: COPYING - summary: 'IfcOpenShell is a library to support the IFC file format' + summary: IfcOpenShell is a library to support the IFC file format description: | IfcOpenShell ============ @@ -293,8 +307,9 @@ about: [MSYS2]: https://msys2.github.io/ "MSYS2" [win/readme.md]: https://github.com/IfcOpenShell/IfcOpenShell/tree/master/win/readme.md "win/readme.md" [nix/build-all.py]: https://github.com/IfcOpenShell/IfcOpenShell/tree/master/nix/build-all.py "nix/build-all.py" - doc_url: https://ifcopenshell.org/ - dev_url: https://github.com/IfcOpenShell/IfcOpenShell + homepage: https://ifcopenshell.org + repository: https://github.com/IfcOpenShell/IfcOpenShell + documentation: https://ifcopenshell.org/ extra: recipe-maintainers: diff --git a/conda/update_version_init.py b/conda/update_version_init.py new file mode 100644 index 0000000000..e5a7a6fd22 --- /dev/null +++ b/conda/update_version_init.py @@ -0,0 +1,32 @@ +import re +import argparse +from pathlib import Path + +def update_version(file_path: str, version: str) -> None: + """Update the version string in the given __init__.py file.""" + file_path = Path(file_path) + + # Read the file and replace the version + file_contents = file_path.read_text(encoding="utf-8") + new_contents = re.sub(r'version = "0\.0\.0"', f'version = "{version}"', file_contents) + + # Write the updated contents back to the file + file_path.write_text(new_contents, encoding="utf-8") + + print(f"Updated version in {file_path} to {version}") + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Update the version string in a Python file.") + parser.add_argument( + "version", + type=str, + help="The version string to replace '0.0.0' with (e.g., '1.2.3')." + ) + parser.add_argument( + "file", + type=str, + help="The path to the __init__.py file where the version will be updated." + ) + + args = parser.parse_args() + update_version(args.file, args.version)