Skip to content

Commit

Permalink
fix(python): pull readme, license info into python folder and central…
Browse files Browse the repository at this point in the history
…ize version
  • Loading branch information
craftablescience committed Nov 5, 2024
1 parent b3e9897 commit b7de176
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
with:
submodules: recursive

- name: Configure CMake
working-directory: '${{github.workspace}}'
run: cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DSOURCEPP_BUILD_PYTHON_WRAPPERS=ON

- name: Build SDist
run: |
pipx run build --sdist
Expand Down
21 changes: 18 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
# IDEs
# IDE
.idea/
.vs/
.vscode/
CMakeSettings.json

# Project exclude paths

# Build
build/
dist/
cmake-build-*/
out/

# Generated

# Docs
docs/html/


# Test
test/res/
test/Helpers.h


# Python
.mypy_cache/
__pycache__/
wheelhouse/
*.pyd
*.pyi
*.typed
*.whl

lang/python/pyproject.toml
lang/python/src/sourcepp/__init__.py

lang/python/LICENSE
lang/python/README.md
lang/python/THIRDPARTY_LEGAL_NOTICES.txt
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ endif()


# Create project
project(sourcepp)
project(sourcepp
DESCRIPTION "Several modern C++20 libraries for sanely parsing Valve formats.")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down Expand Up @@ -101,6 +102,7 @@ endif()
# Python bindings, part 1
if(SOURCEPP_BUILD_PYTHON_WRAPPERS)
set(SOURCEPP_PYTHON_NAME "${PROJECT_NAME}_python")
set(SOURCEPP_PYTHON_VERSION "2024.11.5dev2")
find_package(Python REQUIRED
COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)
Expand All @@ -111,6 +113,15 @@ if(SOURCEPP_BUILD_PYTHON_WRAPPERS)
FetchContent_MakeAvailable(nanobind)
set(${SOURCEPP_PYTHON_NAME}_SOURCES "")
set(${SOURCEPP_PYTHON_NAME}_DEFINES "")

# Set the version here
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lang/python/cfg/pyproject.toml" "${CMAKE_CURRENT_SOURCE_DIR}/lang/python/pyproject.toml")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lang/python/cfg/__init__.py" "${CMAKE_CURRENT_SOURCE_DIR}/lang/python/src/sourcepp/__init__.py")

# These need to be inside the python directory, let's duplicate them!
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_SOURCE_DIR}/lang/python/LICENSE" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/README.md" "${CMAKE_CURRENT_SOURCE_DIR}/lang/python/README.md" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/THIRDPARTY_LEGAL_NOTICES.txt" "${CMAKE_CURRENT_SOURCE_DIR}/lang/python/THIRDPARTY_LEGAL_NOTICES.txt" COPYONLY)
endif()


Expand Down
9 changes: 0 additions & 9 deletions lang/python/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ._sourcepp_impl import __doc__, gamepp, sourcepp, steampp, vcryptpp, vtfpp

__author__ = "craftablescience"
__version__ = "2024.11.5dev1" # change pyproject.toml version when this is updated
__version__ = "${SOURCEPP_PYTHON_VERSION}"
__all__ = ['__author__', '__doc__', '__version__', 'gamepp', 'sourcepp', 'steampp', 'vcryptpp', 'vtfpp']
7 changes: 4 additions & 3 deletions lang/python/pyproject.toml → lang/python/cfg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ build-backend = "scikit_build_core.build"

[project]
name = "sourcepp"
version = "2024.11.5dev1" # change __init__.py when this is updated
version = "${SOURCEPP_PYTHON_VERSION}"
authors = [{ name = "craftablescience", email = "[email protected]" }]
maintainers = [{ name = "craftablescience", email = "[email protected]" }]
description = "Several modern C++20 libraries for sanely parsing Valve formats."
readme = "../../README.md"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"License :: OSI Approved :: MIT License",
Expand All @@ -33,8 +33,9 @@ minimum-version = "build-system.requires"
build-dir = "build/{wheel_tag}"
build.targets = ["sourcepp_python_all"]
sdist.reproducible = true
sdist.exclude = ["cfg/*"]
wheel.py-api = "cp312"
wheel.license-files = ["../../LICENSE", "../../THIRDPARTY_LEGAL_NOTICES.txt"]
wheel.license-files = ["LICENSE", "THIRDPARTY_LEGAL_NOTICES.txt"]
build.verbose = true
logging.level = "INFO"

Expand Down

0 comments on commit b7de176

Please sign in to comment.