Skip to content

Commit 21ed826

Browse files
committed
Merge branch 'master' of https://github.com/s0d3s/PyAudioWPatch
2 parents cb1c184 + 7be15c0 commit 21ed826

File tree

3 files changed

+80
-3
lines changed

3 files changed

+80
-3
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
release-build:
11+
name: Build Python Package
12+
runs-on: windows-latest
13+
14+
steps:
15+
- run: git config --global core.autocrlf input
16+
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Cygwin Action
21+
uses: cygwin/cygwin-install-action@v5
22+
with:
23+
packages: >
24+
mingw64-x86_64-gcc-core
25+
mingw64-i686-gcc-core
26+
libtool
27+
autoconf
28+
automake
29+
make
30+
31+
- name: Setup Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: '3.11'
35+
36+
- name: Install requirements
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install wheel cibuildwheel
40+
41+
- name: Build the package
42+
run: ./cygwin_cibuildwheel_build.sh
43+
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o igncr -o pipefail {0}
44+
45+
- name: Upload wheels
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: release-wheels
49+
path: wheelhouse/
50+
51+
pypi-publish:
52+
runs-on: ubuntu-latest
53+
needs:
54+
- release-build
55+
56+
environment:
57+
name: pypi
58+
permissions:
59+
id-token: write
60+
61+
steps:
62+
- name: Retrieve release distributions
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: release-wheels
66+
path: dist/
67+
68+
- name: Publish release distributions to PyPI
69+
uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
packages-dir: dist/

cygwin_cibuildwheel_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
CIBW_SKIP="cp36*" CIBW_BUILD="cp3*" cibuildwheel --platform windows
3+
FORCE_CYGWIN_ENV=true PYTHONUTF8=1 CIBW_SKIP="cp36*" CIBW_BUILD="cp3*" cibuildwheel --platform windows

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2626
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
"""
28-
28+
2929
import os
3030
import sys
3131
import logging
@@ -38,10 +38,16 @@
3838
__author__ = "Hubert Pham(S0D3S edition)"
3939

4040

41+
def get_bool_from_env(var_name, default=None):
42+
value = os.environ.get(var_name, default)
43+
return value if value is None else value.lower() in ("1", "true")
44+
45+
4146
IS_CROSS_COMPILING = os.environ.get('PAWP_C_C_FLAG', None) == "TRUE" # used when building with cibuildwheel
4247

4348
MAC_SYSROOT_PATH = os.environ.get("SYSROOT_PATH", None)
4449
WIN_VCPKG_PATH = os.environ.get("VCPKG_PATH", None)
50+
FORCE_CYGWIN_ENV = get_bool_from_env("FORCE_CYGWIN_ENV", default=None)
4551

4652
PORTAUDIO_PATH = os.path.abspath(os.environ.get("PORTAUDIO_PATH", "./portaudio_v19"))
4753

@@ -108,7 +114,7 @@ def setup_extension():
108114
else:
109115
extra_link_args.append(os.path.join(PORTAUDIO_PATH, 'lib_dist/libportaudio-x86.a'))
110116

111-
if 'ORIGINAL_PATH' in os.environ and 'cygdrive' in os.environ['ORIGINAL_PATH']:
117+
if FORCE_CYGWIN_ENV or 'ORIGINAL_PATH' in os.environ and 'cygdrive' in os.environ['ORIGINAL_PATH']:
112118
external_libraries += ["winmm","ole32","uuid"]
113119
extra_link_args += ["-lwinmm","-lole32","-luuid"]
114120
else:

0 commit comments

Comments
 (0)