Skip to content

Commit 4f2b25e

Browse files
committed
WIP
1 parent 3f63b75 commit 4f2b25e

File tree

2 files changed

+208
-0
lines changed

2 files changed

+208
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Deploy
2+
3+
on:
4+
5+
workflow_dispatch:
6+
7+
inputs:
8+
9+
version:
10+
description: 'pilotlight version'
11+
required: true
12+
default: '0.1.0'
13+
14+
deploy:
15+
description: 'Deploy (true will deploy to pypi)'
16+
required: true
17+
default: 'false'
18+
19+
deploytest:
20+
description: 'Deploy (true will deploy to test pypi)'
21+
required: true
22+
default: 'false'
23+
24+
jobs:
25+
26+
build-package:
27+
28+
runs-on: windows-2022
29+
strategy:
30+
matrix:
31+
python-version: [ 3.14 ]
32+
33+
steps:
34+
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Show Python build paths
43+
run: |
44+
python -c "import sys, sysconfig; print(sys.executable); print(sys.version)"
45+
python -c "import sysconfig; print('include=', sysconfig.get_paths()['include'])"
46+
python -c "import sysconfig; print('platinclude=', sysconfig.get_paths().get('platinclude'))"
47+
python -c "import sysconfig; print('EXT_SUFFIX=', sysconfig.get_config_var('EXT_SUFFIX'))"
48+
49+
- name: Retrieve submodules
50+
shell: cmd
51+
run: |
52+
53+
python -m pip install pl-build
54+
git submodule update --init --recursive ./dependencies/cpython
55+
cd ..
56+
git clone https://github.com/PilotLightTech/pilotlight
57+
58+
- name: Build package
59+
shell: cmd
60+
run: |
61+
cd %GITHUB_WORKSPACE%
62+
cd scripts
63+
python gen_build.py
64+
cd ../src
65+
build.bat -c release
66+
cd ../scripts
67+
python package.py
68+
cd ..
69+
70+
- name: Install dependencies
71+
run: |
72+
python -m pip install --upgrade pip twine wheel setuptools
73+
74+
- name: Build Wheel
75+
shell: cmd
76+
run: |
77+
cd %GITHUB_WORKSPACE%
78+
python -m setup bdist_wheel --plat-name win_amd64 --dist-dir dist
79+
80+
- uses: actions/upload-artifact@v4
81+
with:
82+
name: pltools wheel
83+
path: |
84+
${{ github.workspace }}/dist/*.whl
85+
${{ github.workspace }}/dist/*.tar.gz
86+
retention-days: 1
87+
if-no-files-found: error
88+
89+
- name: PyPi Deployment
90+
shell: cmd
91+
if: ${{contains(github.event.inputs.deploy, 'true') && github.ref == 'refs/heads/master'}}
92+
run: |
93+
python -m pip install twine
94+
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --skip-existing
95+
96+
- name: Test PyPi Deployment
97+
shell: cmd
98+
if: ${{contains(github.event.inputs.deploytest, 'true') && github.ref == 'refs/heads/master'}}
99+
run: |
100+
python -m pip install twine
101+
python -m twine upload --repository testpypi dist/* -u __token__ -p ${{ secrets.TEST_PYPI_API_TOKEN }} --skip-existing

setup.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
from setuptools import setup, find_packages, Distribution
2+
from setuptools.command import build_py
3+
import distutils.cmd
4+
from codecs import open
5+
import os
6+
from os import path
7+
import textwrap
8+
import sys
9+
import shutil
10+
import subprocess
11+
12+
wip_version = "0.1.0"
13+
14+
def get_platform():
15+
16+
platforms = {
17+
'linux' : 'Linux',
18+
'linux1' : 'Linux',
19+
'linux2' : 'Linux',
20+
'darwin' : 'OS X',
21+
'win32' : 'Windows'
22+
}
23+
if sys.platform not in platforms:
24+
return sys.platform
25+
26+
return platforms[sys.platform]
27+
28+
class BinaryDistribution(Distribution):
29+
def has_ext_modules(var):
30+
return True
31+
32+
class DPGBuildCommand(distutils.cmd.Command):
33+
34+
description = 'DPG Build Command'
35+
user_options = []
36+
37+
def initialize_options(self):
38+
pass
39+
40+
def finalize_options(self):
41+
pass
42+
43+
def run(self):
44+
pass
45+
46+
class BuildPyCommand(build_py.build_py):
47+
def run(self):
48+
self.run_command('dpg_build')
49+
build_py.build_py.run(self)
50+
51+
def setup_package():
52+
53+
src_path = os.path.dirname(os.path.abspath(__file__))
54+
old_path = os.getcwd()
55+
os.chdir(src_path)
56+
sys.path.insert(0, src_path)
57+
58+
metadata = dict(
59+
name='pilotlight', # Required
60+
version=wip_version, # Required
61+
author="Jonathan Hoffstadt", # Optional
62+
author_email="jonathanhoffstadt@yahoo.com", # Optional
63+
description='Pilot Light', # Required
64+
# long_description=long_description, # Optional
65+
# long_description_content_type='text/markdown', # Optional
66+
# url='https://github.com/PilotLightTech/pilotlight-python', # Optional
67+
license = 'MIT',
68+
python_requires='>=3.14',
69+
classifiers=[
70+
'Development Status :: 5 - Production/Stable',
71+
'Intended Audience :: Education',
72+
'Intended Audience :: Developers',
73+
'Intended Audience :: Science/Research',
74+
'License :: OSI Approved :: MIT License',
75+
'Operating System :: Microsoft :: Windows :: Windows 10',
76+
'Programming Language :: Python :: 3.14',
77+
'Programming Language :: Python :: Implementation :: CPython',
78+
'Programming Language :: Python :: 3 :: Only',
79+
'Topic :: Software Development :: User Interfaces',
80+
'Topic :: Software Development :: Libraries :: Python Modules',
81+
],
82+
packages=['pilotlight'],
83+
package_dir = {'': 'out'},
84+
package_data={},
85+
distclass=BinaryDistribution,
86+
cmdclass={
87+
'dpg_build': DPGBuildCommand,
88+
'build_py': BuildPyCommand,
89+
},
90+
)
91+
92+
if get_platform() == "Windows":
93+
metadata['package_data']['pilotlight'] = ["__init__.py", "pilotlight.pyd", "pilotlight.pyi", "pl_core.py", "pl_draw_ext.py", "pl_starter_ext.py", "pl_ui_ext.py", "pl_vfs_ext.py", "spirv-cross-c-shared.dll"]
94+
95+
if "--force" in sys.argv:
96+
sys.argv.remove('--force')
97+
98+
try:
99+
setup(**metadata)
100+
finally:
101+
del sys.path[0]
102+
os.chdir(old_path)
103+
return
104+
105+
if __name__ == '__main__':
106+
setup_package()
107+

0 commit comments

Comments
 (0)