Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove abi3 to see if that makes graal happier
Browse files Browse the repository at this point in the history
masklinn committed Oct 5, 2024

Verified

This commit was signed with the committer’s verified signature.
ras0q Kira Kawai
1 parent ffe4fae commit 45efc61
Showing 3 changed files with 28 additions and 24 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/pyo3-wheels.yml
Original file line number Diff line number Diff line change
@@ -18,6 +18,10 @@ on:
permissions:
contents: read

env:
BASE: --out dist -m ua-parser-py/Cargo.toml
COMMON: --release --out dist -m ua-parser-py/Cargo.toml

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
@@ -26,12 +30,12 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
#- runner: ubuntu-latest
# target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
#- runner: ubuntu-latest
# target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -41,7 +45,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --zig
args: ${{ env.COMMON }} --zig
sccache: 'true'
manylinux: auto
- name: Upload wheels
@@ -57,12 +61,12 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
#- runner: ubuntu-latest
# target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
#- runner: ubuntu-latest
# target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -72,7 +76,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: ${{ env.COMMON }}
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
@@ -88,8 +92,8 @@ jobs:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
#- runner: windows-latest
# target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -100,7 +104,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: ${{ env.COMMON }}
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
@@ -113,9 +117,9 @@ jobs:
strategy:
matrix:
platform:
- runner: macos-12
- runner: macos-13
target: x86_64
- runner: macos-14
- runner: macos-13
target: aarch64
steps:
- uses: actions/checkout@v4
@@ -126,7 +130,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: ${{ env.COMMON }}
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
@@ -142,7 +146,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
args: ${{ env.BASE }}
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
2 changes: 1 addition & 1 deletion ua-parser-py/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,5 +9,5 @@ name = "ua_parser_rs"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.20.0", features = ["extension-module", "abi3", "abi3-py38"] }
pyo3 = { version = "0.22", features = ["extension-module", "abi3", "abi3-py38"] }
ua-parser = { version = "0.2.0", path = "../ua-parser" }
12 changes: 6 additions & 6 deletions ua-parser-py/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
/// An uap-python Resolver is a callable which returns a PartialResult
/// (~a triplet of optional user_agent, os, and domain). A resolver
/// has lists of matchers for user agents, os, and devices taken in as
@@ -27,6 +25,8 @@ use pyo3::prelude::*;
/// them to Parsers as well but that's still very confusing given the
/// global Parser object, unless *that* gets renamed to Extractor on
/// the python side, or something.
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use std::borrow::Cow::{self, Owned};

type UAParser = (
@@ -55,7 +55,7 @@ struct UserAgent {
#[pymethods]
impl UserAgentExtractor {
#[new]
fn new(it: &PyAny) -> PyResult<Self> {
fn new(it: &Bound<PyAny>) -> PyResult<Self> {
use ua_parser::user_agent::{Builder, Parser};
it.iter()?
.try_fold(Builder::new(), |s, p| {
@@ -111,7 +111,7 @@ struct OS {
#[pymethods]
impl OSExtractor {
#[new]
fn new(it: &PyAny) -> PyResult<Self> {
fn new(it: &Bound<PyAny>) -> PyResult<Self> {
use ua_parser::os::{Builder, Parser};
it.iter()?
.try_fold(Builder::new(), |s, p| {
@@ -162,7 +162,7 @@ struct Device {
#[pymethods]
impl DeviceExtractor {
#[new]
fn new(it: &PyAny) -> PyResult<Self> {
fn new(it: &Bound<PyAny>) -> PyResult<Self> {
use ua_parser::device::{Builder, Flag, Parser};
it.iter()?
.try_fold(Builder::new(), |s, p| {
@@ -194,7 +194,7 @@ impl DeviceExtractor {
}

#[pymodule]
fn ua_parser_rs(_py: Python, m: &PyModule) -> PyResult<()> {
fn ua_parser_rs(m: &Bound<PyModule>) -> PyResult<()> {
m.add_class::<UserAgentExtractor>()?;
m.add_class::<OSExtractor>()?;
m.add_class::<DeviceExtractor>()?;

0 comments on commit 45efc61

Please sign in to comment.