Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit a497ce8

Browse files
committed
v1.0.0b1
0 parents  commit a497ce8

File tree

2,372 files changed

+1734382
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,372 files changed

+1734382
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.github/workflows/publish.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: build
2+
on:
3+
push:
4+
tags:
5+
- v1.*
6+
7+
jobs:
8+
sdist:
9+
runs-on: windows-2019
10+
steps:
11+
- uses: actions/checkout@v2
12+
- run: python -m pip install build
13+
- run: python -m build --sdist
14+
- uses: actions/upload-artifact@v2
15+
with:
16+
name: sdist_${{ github.run_id }}
17+
path: dist/
18+
19+
bdist:
20+
runs-on: windows-2019
21+
strategy:
22+
matrix:
23+
python-version: ['3.7', '3.8', '3.9', '3.10']
24+
architecture: ['x86', 'x64']
25+
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }} bdist
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
architecture: ${{ matrix.architecture }}
32+
- run: python -m pip install build
33+
- name: Run python -m build --wheel
34+
run: |
35+
Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
36+
Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" -DevCmdArguments '-arch=${{ matrix.architecture }}'
37+
python -m build --wheel
38+
- uses: actions/upload-artifact@v2
39+
with:
40+
name: bdist_${{ matrix.python-version }}_${{ matrix.architecture }}_${{ github.run_id }}
41+
path: dist/
42+
43+
publish:
44+
needs: [sdist, bdist]
45+
runs-on: ubuntu-20.04
46+
steps:
47+
- uses: actions/download-artifact@v2
48+
with:
49+
path: artifacts
50+
- run: |
51+
mkdir -p dist
52+
mv artifacts/{b,s}dist_*/* dist/
53+
- uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
user: __token__
56+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# project-specific
2+
_build/
3+
_nuget/
4+
_skbuild/
5+
6+
# Byte-compiled / optimized / DLL files
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
11+
# C extensions
12+
*.so
13+
14+
# Distribution / packaging
15+
.Python
16+
build/
17+
develop-eggs/
18+
dist/
19+
downloads/
20+
eggs/
21+
.eggs/
22+
lib/
23+
lib64/
24+
parts/
25+
sdist/
26+
var/
27+
wheels/
28+
pip-wheel-metadata/
29+
share/python-wheels/
30+
*.egg-info/
31+
.installed.cfg
32+
*.egg
33+
MANIFEST
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.nox/
49+
.coverage
50+
.coverage.*
51+
.cache
52+
nosetests.xml
53+
coverage.xml
54+
*.cover
55+
*.py,cover
56+
.hypothesis/
57+
.pytest_cache/
58+
59+
# Translations
60+
*.mo
61+
*.pot
62+
63+
# Django stuff:
64+
*.log
65+
local_settings.py
66+
db.sqlite3
67+
db.sqlite3-journal
68+
69+
# Flask stuff:
70+
instance/
71+
.webassets-cache
72+
73+
# Scrapy stuff:
74+
.scrapy
75+
76+
# Sphinx documentation
77+
docs/_build/
78+
79+
# PyBuilder
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
.python-version
91+
92+
# pipenv
93+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96+
# install all needed dependencies.
97+
#Pipfile.lock
98+
99+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
100+
__pypackages__/
101+
102+
# Celery stuff
103+
celerybeat-schedule
104+
celerybeat.pid
105+
106+
# SageMath parsed files
107+
*.sage.py
108+
109+
# Environments
110+
.env
111+
.venv
112+
env/
113+
venv/
114+
ENV/
115+
env.bak/
116+
venv.bak/
117+
118+
# Spyder project settings
119+
.spyderproject
120+
.spyproject
121+
122+
# Rope project settings
123+
.ropeproject
124+
125+
# mkdocs documentation
126+
/site
127+
128+
# mypy
129+
.mypy_cache/
130+
.dmypy.json
131+
dmypy.json
132+
133+
# Pyre type checker
134+
.pyre/

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- refer to https://keepachangelog.com for guidance. -->
2+
3+
# Changelog
4+
5+
## [Unreleased]
6+
7+
## [v1.0.0b1] - 2022-01-27
8+
9+
- Initial release.
10+
11+
12+
[Unreleased]: https://github.com/pywinrt/python-winsdk/compare/v1.0.0b1...HEAD
13+
[v1.0.0b1]: https://github.com/pywinrt/python-winsdk/tags/v1.0.0b1

CMakeLists.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(winsdk)
3+
4+
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/pywinrt/${CMAKE_PROJECT_NAME}/src/*.cpp")
5+
foreach(file ${sources})
6+
message(${file})
7+
endforeach()
8+
9+
set(CMAKE_CXX_STANDARD 17)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
12+
13+
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
14+
add_compile_options(/await /bigobj /GR- /permissive-)
15+
16+
# strip suffix to allow support for prerelease version
17+
string(REGEX MATCH "^[0-9]\\.[0-9]+(\\.[0-9]+)?" PYTHON_BASE_VERSION ${PYTHON_VERSION_STRING})
18+
19+
find_package (Python3 ${PYTHON_BASE_VERSION} EXACT COMPONENTS Interpreter Development)
20+
21+
Python3_add_library (_winrt MODULE ${sources})
22+
set_target_properties(_winrt PROPERTIES LIBRARY_OUTPUT_NAME_DEBUG _winrt_d)
23+
target_precompile_headers(_winrt PRIVATE <winrt/base.h> [["pybase.h"]])
24+
target_include_directories(_winrt PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/cppwinrt" "${CMAKE_CURRENT_SOURCE_DIR}/pywinrt/${CMAKE_PROJECT_NAME}/src")
25+
target_link_libraries(_winrt PRIVATE onecore)
26+
27+
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
28+
# TODO: re-enable /GL and /LTCG when we get a bigger build machine
29+
# string(APPEND CMAKE_MODULE_LINKER_FLAGS " /LTCG:STATUS")
30+
31+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.20.27404.0")
32+
string(APPEND CMAKE_CXX_FLAGS " /d2FH4")
33+
endif()
34+
35+
install(TARGETS _winrt DESTINATION "pywinrt/${CMAKE_PROJECT_NAME}")

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
## Prerequisites
3+
4+
- [Python](https://www.python.org/downloads/) >= 3.7
5+
- [Nuget](https://www.nuget.org/downloads)
6+
7+
## Get the code
8+
9+
git clone https://github.com/pywinrt/python-winsdk
10+
cd python-winsdk
11+
12+
## Create a debug build
13+
14+
Note: this requires that `python_d.exe` is installed.
15+
16+
./build.ps1
17+
18+
## Build the package
19+
20+
py -m pip install build
21+
py -m build
22+
23+
## Update the generated files
24+
25+
Note: the `cppwint` and `pywinrt` directories are generated and should not be
26+
manually edited.
27+
28+
./generate.ps1

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation
4+
Copyright (c) 2021-2022 David Lechner
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

MANIFEST.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
graft cppwinrt
2+
graft pywinrt
3+
recursive-exclude pywinrt *.pyc
4+
recursive-exclude pywinrt *.pyd
5+
include CMakeLists.txt
6+
include LICENSE
7+
include pyproject.toml
8+
include README.md
9+
include setup.py

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Python Windows SDK
2+
3+
Python bindings for the Windows SDK.
4+
5+
This is a community-supported version of the unmaintained [winrt] package.
6+
7+
[winrt]: https://pypi.org/project/winrt
8+
9+
## Documentation
10+
11+
Since the bindings are automatically generated, there are no API docs available.
12+
Instead, use <https://docs.microsoft.com/en-us/uwp/api/> as a reference.
13+
14+
Also be sure to read the [pywinrt docs] that explain how the language projection
15+
works.
16+
17+
[pywinrt docs]: https://github.com/pywinrt/pywinrt/blob/v1.0.0-beta.1/src/package/pywinrt/projection/readme.md

build.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file is useful for creating a debug build.
2+
# Normally scikit-build will be used instead.
3+
4+
param (
5+
[Parameter(Mandatory=$false)]
6+
[string]$buildType = "Debug",
7+
8+
[Parameter(Mandatory=$false)]
9+
[string]$pythonVersion = "3.9"
10+
)
11+
12+
$repoRootPath = (get-item $PSScriptRoot).FullName
13+
$sourcePath = "$PSScriptRoot"
14+
$buildPath = "$repoRootPath\_build\$env:VSCMD_ARG_TGT_ARCH-$buildType"
15+
$packagePath = "$sourcePath\pywinrt"
16+
17+
cmake -S $sourcePath "-B$buildPath" -GNinja "-DCMAKE_BUILD_TYPE=$buildType" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl "-DPYTHON_VERSION_STRING=$pythonVersion"
18+
cmake --build $buildPath -- -v
19+
20+
Copy-Item "$buildPath\*.pyd" "$packagePath\winsdk\"

0 commit comments

Comments
 (0)