Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .github/workflows/macos-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,26 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install build and pytest Python packages
run: sudo pip install build pytest
- name: Install MacPorts
# sudo is required to restore macports cache, apply same workaround from
# https://github.com/actions/cache/issues/629#issuecomment-1189184648
- name: Install gtar wrapper
run: |
gtar_path=$(which gtar)
echo "#!/bin/sh" > gtar
echo "exec sudo $gtar_path.orig \"\$@\"" >> gtar
sudo mv $gtar_path $gtar_path.orig
sudo mv gtar $gtar_path
sudo chmod +x $gtar_path
- name: Restore macports cache
id: restore-macports-cache
uses: actions/cache/restore@v5
with:
path: /opt/local/
key: macports-cache-${{ matrix.config.arch }}-${{ matrix.config.os }}
restore-keys: macports-cache-${{ matrix.config.arch }}-${{ matrix.config.os }}
- name: Install MacPorts and other tools
run: |
brew install md5sha1sum
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install --sync=rsync
- name: Set macOS deployment target and install MacOSX sdk 11.3
Expand All @@ -37,6 +55,17 @@ jobs:
sudo mv MacOSX11.3.sdk /Library/Developer/CommandLineTools/SDKs/
- name: Install subvertpy build dependencies
run: sudo port -N -s install subversion db48
# hash software source paths including versions to get a cache key
- name: Compute cache key
id: cache-key
run: |
echo "value=$(find /opt/local/var/macports/software | sha1sum | cut -c1-40)" >> $GITHUB_OUTPUT
shell: bash
- name: Save macports cache
uses: actions/cache/save@v5
with:
path: /opt/local/
key: macports-cache-${{ matrix.config.arch }}-${{ matrix.config.os }}-${{ steps.cache-key.outputs.value }}
- name: Sets CIBW_BUILD and SDKROOT environment variable
env:
pyVer: "${{matrix.python-version}}"
Expand All @@ -54,7 +83,13 @@ jobs:
working-directory: wheelhouse
run: |
pip install $(ls -t | head -1)
python -c "from subvertpy import client, ra, repos, subr, wc"

# check modules import and https support
python -c "
from subvertpy import client, ra, repos, subr, wc;
client = client.Client(auth=ra.Auth([ra.get_username_provider()]));
client.info('https://svn.pld-linux.org/svn')"

cd ../ && mv subvertpy/tests . && rm -rf subvertpy && python -m pytest tests
- uses: actions/upload-artifact@v4
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/manylinux-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ jobs:
- name: Test wheel can be installed and subvertpy module imported
run: |
$Python3_ROOT_DIR/bin/pip install $(ls -t | head -1)

# check modules import and https support
$Python3_ROOT_DIR/bin/python -c "
from subvertpy import client, ra, repos, subr, wc"
from subvertpy import client, ra, repos, subr, wc;
client = client.Client(auth=ra.Auth([ra.get_username_provider()]));
client.info('https://svn.pld-linux.org/svn')"

pip3 install pytest
cd ../ && mv subvertpy/tests . && rm -rf subvertpy && python3 -m pytest tests
working-directory: wheelhouse
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
python-version: "3.x"
- name: Install dependencies
run: sudo apt-get install -y libsvn-dev
run: sudo apt update && sudo apt install -y libsvn-dev
- name: Build sdist
run: |
pip install build
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/windows-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ jobs:
- name: Test built wheel can be installed and imported
working-directory: wheelhouse
run: |
set PATH=%Python3_ROOT_DIR%\Scripts:%PATH%
set PYTHONIOENCODING=utf-8
for /f "tokens=*" %%g in ('dir /b *.whl') do (set wheel=%%g)
pip install %wheel%
python -c "from subvertpy import client, ra, repos, subr, wc"
cd .. && python -m pytest tests
python_dir=$(cygpath -u $Python3_ROOT_DIR)
export PATH=$python_dir:$python_dir/Scripts:$PATH

pip install $(ls -t | head -1)

# check modules import and https support
python -c "
from subvertpy import client, ra, repos, subr, wc;
client = client.Client(auth=ra.Auth([ra.get_username_provider()]));
client.info('https://svn.pld-linux.org/svn')"

pip install pytest
cd ../ && rm -rf subvertpy && python -m pytest tests
shell: msys2 {0}
- uses: actions/upload-artifact@v4
with:
name: subvertpy-wheel-windows-${{ matrix.python-version }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ apidocs
.tox/
.pybuild
subvertpy.egg-info

# bundled certificate for wheels
subvertpy/cert/cacert.pem
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools", "requests"]
build-backend = "setuptools.build_meta"

[tool.ruff]
exclude = [
"build",
Expand Down
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,14 @@ def subvertpy_modules():


def package_data():
if sys.platform == "win32":
return {"subvertpy": ["subvertpy/*.dll"]}
else:
return {}
import requests

os.makedirs("subvertpy/cert", exist_ok=True)
with open("subvertpy/cert/cacert.pem", "wb") as cert:
response = requests.get("https://curl.se/ca/cacert.pem")
response.raise_for_status()
cert.write(response.content)
return {"subvertpy": ["cert/cacert.pem"]}


subvertpy_version = (0, 11, 1)
Expand Down
11 changes: 11 additions & 0 deletions subvertpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@
SSL_UNKNOWNCA = 0x00000008
SSL_OTHER = 0x40000000

_module_dir = os.path.dirname(__file__)
_wheel_libs_dir = os.path.join(_module_dir, "../subvertpy.libs")
_wheel_dylibs_dir = os.path.join(_module_dir, ".dylibs")

if os.path.exists(_wheel_libs_dir) or os.path.exists(_wheel_dylibs_dir):
# when subvertpy is installed from a binary wheel the hardcoded path to
# certificates in bundled openssl does not necessarily exist on the host
# system so we ensure one can be found or manipulating remote svn repos
# through HTTPS does not work
os.environ["SSL_CERT_FILE"] = os.path.join(_module_dir, "cert/cacert.pem")


class SubversionException(Exception):
"""A Subversion exception"""
Expand Down
Loading