From ad9f13af370668d8809e0ee12089b82765ff017a Mon Sep 17 00:00:00 2001 From: gmweaver Date: Wed, 5 Jun 2024 19:39:04 -0700 Subject: [PATCH] cleanup --- .github/workflows/wheels.yml | 3 +-- install_libpostal.sh | 35 ----------------------------------- pyproject.toml | 2 ++ setup.py | 19 ------------------- tests/test_parser.py | 8 ++++---- 5 files changed, 7 insertions(+), 60 deletions(-) delete mode 100755 install_libpostal.sh diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1eb753f..c3322cc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -8,8 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] - cibw_build: ["cp39-* cp310-* cp311-*"] + os: [ubuntu-latest, macos-13, macos-latest] steps: - uses: actions/checkout@v4 diff --git a/install_libpostal.sh b/install_libpostal.sh deleted file mode 100755 index 49f433c..0000000 --- a/install_libpostal.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -OS=$(uname -s) - -case $OS in - Linux) - echo "Detected Linux" - # Linux-specific commands here - ;; - Darwin) - echo "Detected macOS" - # macOS-specific commands here - ;; - FreeBSD) - echo "Detected FreeBSD" - # FreeBSD-specific commands here - ;; - *) - echo "OS not supported" - # Handle unsupported OS here - ;; -esac - -cd $1 -git clone https://github.com/openvenues/libpostal -cd libpostal -git checkout tags/v1.1 -./bootstrap.sh -./configure --datadir=/tmp/libpostal_data_files --disable-data-download --disable-sse2 -make -j4 -sudo make install - -if [ "$OS" = "Linux" ]; then - sudo ldconfig -fi diff --git a/pyproject.toml b/pyproject.toml index a4c0f33..af29fed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,8 @@ [project] name = "libpypostal" version = "1.1.0" +readme = "README.md" +requires-python = ">=3.8" [build-system] requires = ["setuptools"] diff --git a/setup.py b/setup.py index 0752745..5567617 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,5 @@ -import ctypes.util -import subprocess -import tempfile - from setuptools import setup, Extension - -def _libpostal_installed() -> bool: - """Checks if libpostal is installed.""" - return ctypes.util.find_library("postal") is not None - - -def _install_libpostal() -> None: - """Installs libpostal.""" - with tempfile.TemporaryDirectory() as tempdir: - subprocess.run(["./install_libpostal.sh", tempdir], check=True) - - -# if not _libpostal_installed(): -# _install_libpostal() - ext_modules = [ Extension( "libpypostal._parser", diff --git a/tests/test_parser.py b/tests/test_parser.py index f7e3806..250cdcc 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -4,7 +4,7 @@ from libpypostal import parser -@patch("libpypostal._parse_address") +@patch("libpypostal.parser._parse_address") def test_parse_address_single_match_each_component( mock__parser_parse_address: MagicMock, ) -> None: @@ -44,11 +44,11 @@ def test_parse_address_single_match_each_component( assert actual == expected mock__parser_parse_address.assert_called_once_with( - test_address, language=None, country=None + test_address, language=None, country_code=None ) -@patch("libpypostal._parse_address") +@patch("libpypostal.parser._parse_address") def test_parse_address_multiple_matches_for_component( mock__parser_parse_address: MagicMock, ) -> None: @@ -89,5 +89,5 @@ def test_parse_address_multiple_matches_for_component( assert actual == expected mock__parser_parse_address.assert_called_once_with( - test_address, language=None, country=None + test_address, language=None, country_code=None )