Skip to content

Commit

Permalink
v1.0.0b1
Browse files Browse the repository at this point in the history
  • Loading branch information
dlech committed Jan 28, 2022
0 parents commit a497ce8
Show file tree
Hide file tree
Showing 2,372 changed files with 1,734,382 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
56 changes: 56 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build
on:
push:
tags:
- v1.*

jobs:
sdist:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- run: python -m pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v2
with:
name: sdist_${{ github.run_id }}
path: dist/

bdist:
runs-on: windows-2019
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
architecture: ['x86', 'x64']
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }} bdist
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- run: python -m pip install build
- name: Run python -m build --wheel
run: |
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" -DevCmdArguments '-arch=${{ matrix.architecture }}'
python -m build --wheel
- uses: actions/upload-artifact@v2
with:
name: bdist_${{ matrix.python-version }}_${{ matrix.architecture }}_${{ github.run_id }}
path: dist/

publish:
needs: [sdist, bdist]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v2
with:
path: artifacts
- run: |
mkdir -p dist
mv artifacts/{b,s}dist_*/* dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# project-specific
_build/
_nuget/
_skbuild/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- refer to https://keepachangelog.com for guidance. -->

# Changelog

## [Unreleased]

## [v1.0.0b1] - 2022-01-27

- Initial release.


[Unreleased]: https://github.com/pywinrt/python-winsdk/compare/v1.0.0b1...HEAD
[v1.0.0b1]: https://github.com/pywinrt/python-winsdk/tags/v1.0.0b1
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.16)
project(winsdk)

file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/pywinrt/${CMAKE_PROJECT_NAME}/src/*.cpp")
foreach(file ${sources})
message(${file})
endforeach()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# TODO: re-enable /GL and /LTCG when we get a bigger build machine
add_compile_options(/await /bigobj /GR- /permissive-)

# strip suffix to allow support for prerelease version
string(REGEX MATCH "^[0-9]\\.[0-9]+(\\.[0-9]+)?" PYTHON_BASE_VERSION ${PYTHON_VERSION_STRING})

find_package (Python3 ${PYTHON_BASE_VERSION} EXACT COMPONENTS Interpreter Development)

Python3_add_library (_winrt MODULE ${sources})
set_target_properties(_winrt PROPERTIES LIBRARY_OUTPUT_NAME_DEBUG _winrt_d)
target_precompile_headers(_winrt PRIVATE <winrt/base.h> [["pybase.h"]])
target_include_directories(_winrt PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/cppwinrt" "${CMAKE_CURRENT_SOURCE_DIR}/pywinrt/${CMAKE_PROJECT_NAME}/src")
target_link_libraries(_winrt PRIVATE onecore)

string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
# string(APPEND CMAKE_MODULE_LINKER_FLAGS " /LTCG:STATUS")

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.20.27404.0")
string(APPEND CMAKE_CXX_FLAGS " /d2FH4")
endif()

install(TARGETS _winrt DESTINATION "pywinrt/${CMAKE_PROJECT_NAME}")
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

## Prerequisites

- [Python](https://www.python.org/downloads/) >= 3.7
- [Nuget](https://www.nuget.org/downloads)

## Get the code

git clone https://github.com/pywinrt/python-winsdk
cd python-winsdk

## Create a debug build

Note: this requires that `python_d.exe` is installed.

./build.ps1

## Build the package

py -m pip install build
py -m build

## Update the generated files

Note: the `cppwint` and `pywinrt` directories are generated and should not be
manually edited.

./generate.ps1
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) Microsoft Corporation
Copyright (c) 2021-2022 David Lechner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
graft cppwinrt
graft pywinrt
recursive-exclude pywinrt *.pyc
recursive-exclude pywinrt *.pyd
include CMakeLists.txt
include LICENSE
include pyproject.toml
include README.md
include setup.py
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Python Windows SDK

Python bindings for the Windows SDK.

This is a community-supported version of the unmaintained [winrt] package.

[winrt]: https://pypi.org/project/winrt

## Documentation

Since the bindings are automatically generated, there are no API docs available.
Instead, use <https://docs.microsoft.com/en-us/uwp/api/> as a reference.

Also be sure to read the [pywinrt docs] that explain how the language projection
works.

[pywinrt docs]: https://github.com/pywinrt/pywinrt/blob/v1.0.0-beta.1/src/package/pywinrt/projection/readme.md
20 changes: 20 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is useful for creating a debug build.
# Normally scikit-build will be used instead.

param (
[Parameter(Mandatory=$false)]
[string]$buildType = "Debug",

[Parameter(Mandatory=$false)]
[string]$pythonVersion = "3.9"
)

$repoRootPath = (get-item $PSScriptRoot).FullName
$sourcePath = "$PSScriptRoot"
$buildPath = "$repoRootPath\_build\$env:VSCMD_ARG_TGT_ARCH-$buildType"
$packagePath = "$sourcePath\pywinrt"

cmake -S $sourcePath "-B$buildPath" -GNinja "-DCMAKE_BUILD_TYPE=$buildType" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl "-DPYTHON_VERSION_STRING=$pythonVersion"
cmake --build $buildPath -- -v

Copy-Item "$buildPath\*.pyd" "$packagePath\winsdk\"
Loading

0 comments on commit a497ce8

Please sign in to comment.