-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
require-libpython
in the wheel
If we're in a user-local install or a venv and we have no libpython SOs linked, create symlinks and fail if we can't Release 0.0.6
- Loading branch information
Showing
10 changed files
with
329 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: wheel-axle-runtime | ||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
required: true | ||
type: string | ||
python-version: | ||
required: true | ||
type: string | ||
deploy: | ||
required: false | ||
type: boolean | ||
default: false | ||
deploy-pip: | ||
required: false | ||
type: string | ||
default: none | ||
deploy-setuptools: | ||
required: false | ||
type: string | ||
exclude: | ||
required: false | ||
type: string | ||
secrets: | ||
PYPI_TOKEN: | ||
required: false | ||
GITHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: false | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ${{ inputs.os }} | ||
python-version: | ||
- ${{ inputs.python-version }} | ||
pip-version: | ||
- '24.2' | ||
- '24.1' | ||
- '24.0' | ||
- '23.3' | ||
- '22.3' | ||
setuptools-version: | ||
- '75.1' | ||
- '74.1' | ||
- '73.0' | ||
- '72.2' | ||
- '71.1' | ||
- '70.3' | ||
- '69.5' | ||
- '68.2' | ||
- '67.8' | ||
- '66.1' | ||
- '65.7' | ||
- '64.0' | ||
- '63.4' | ||
- '62.6' | ||
exclude: | ||
- python-version: '3.12' | ||
setuptools-version: '65.7' | ||
- python-version: '3.12' | ||
pip-version: '22.3' | ||
env: | ||
DEPLOY_PIP: ${{ inputs.deploy-pip }} | ||
DEPLOY_SETUPTOOLS: ${{ inputs.deploy-setuptools }} | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- shell: bash | ||
run: | | ||
echo "PYB_EXTRA_ARGS=--no-venvs" >> $GITHUB_ENV | ||
echo "SETUPTOOLS_VER=~=${{matrix.setuptools-version}}" >> $GITHUB_ENV | ||
echo "PIP_VER=~=${{matrix.pip-version}}" >> $GITHUB_ENV | ||
- shell: bash | ||
if: | | ||
inputs.deploy && | ||
contains(env.DEPLOY_PIP, matrix.pip-version) && | ||
contains(env.DEPLOY_SETUPTOOLS, matrix.setuptools-version) | ||
run: | | ||
echo "PYB_EXTRA_ARGS=+upload --no-venvs" >> $GITHUB_ENV | ||
- uses: pybuilder/build@master | ||
with: | ||
checkout: false | ||
with-venv: false | ||
python-version: ${{ matrix.python-version }} | ||
pyb-extra-args: ${{ env.PYB_EXTRA_ARGS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
use_plugin("filter_resources") | ||
|
||
name = "wheel-axle-runtime" | ||
version = "0.0.6.dev" | ||
version = "0.0.6" | ||
|
||
summary = "Axle Runtime is the runtime part of the Python Wheel enhancement library" | ||
authors = [Author("Karellen, Inc.", "[email protected]")] | ||
|
@@ -100,6 +100,7 @@ def set_properties(project): | |
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Operating System :: POSIX", | ||
"Operating System :: POSIX :: Linux", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
src/integrationtest/python/require_libpython_axle_tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# (C) Copyright 2022 Karellen, Inc. (https://www.karellen.co/) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import site | ||
import sys | ||
import sysconfig | ||
import unittest | ||
from os.path import join as jp, exists, basename, islink | ||
|
||
import pkg_resources | ||
from pip._internal.locations import get_scheme | ||
|
||
from instrumented_axle_tests import InstrumentedAxleTest | ||
|
||
|
||
class RequireLibPythonAxleTest(InstrumentedAxleTest): | ||
def setUp(self) -> None: | ||
super().setUp() | ||
|
||
self.wheel_file = jp(self.test_dir, "test_axle_2_libpython-0.0.1-py3-none-any.whl") | ||
|
||
def check_libpython_present(self, lib_dir): | ||
enable_shared = sysconfig.get_config_var("PY_ENABLE_SHARED") | ||
if not enable_shared or not int(enable_shared): | ||
return | ||
|
||
in_venv = sys.base_exec_prefix != sys.exec_prefix | ||
is_user_site = lib_dir.startswith(site.USER_SITE) | ||
if in_venv or is_user_site: | ||
self.assertTrue(islink(jp(lib_dir, sysconfig.get_config_var("LDLIBRARY")))) | ||
self.assertTrue(islink(jp(lib_dir, sysconfig.get_config_var("INSTSONAME")))) | ||
|
||
def test_install_uninstall(self): | ||
self.install(self.wheel_file) | ||
self.uninstall(self.wheel_file) | ||
|
||
def test_verify_install(self): | ||
self.install(self.wheel_file) | ||
|
||
ws = pkg_resources.WorkingSet() | ||
list(map(ws.add_entry, sys.path)) | ||
pkg = ws.by_key["test-axle-2-libpython"] | ||
scheme = get_scheme("test-axle-2-libpython") | ||
|
||
prefix = scheme.purelib | ||
pth_file = basename(pkg.egg_info[:-len("dist-info")] + "pth") | ||
pth_path = jp(prefix, pth_file) | ||
dist_info = jp(prefix, basename(pkg.egg_info)) | ||
axle_done = jp(dist_info, "axle.done") | ||
|
||
self.assertTrue(exists(pth_path)) | ||
self.assertFalse(exists(axle_done)) | ||
|
||
site.addpackage(prefix, pth_file, None) | ||
|
||
self.assertFalse(exists(pth_path)) | ||
self.assertTrue(exists(axle_done)) | ||
|
||
self.check_installed_contents(scheme) | ||
self.check_libpython_present(jp(scheme.data, sys.platlibdir)) | ||
|
||
self.uninstall(self.wheel_file) | ||
|
||
self.assertFalse(exists(dist_info)) | ||
|
||
@unittest.skipIf(sys.base_prefix != sys.prefix, "no user site available under virtualenv") | ||
def test_verify_user_install(self): | ||
self.install(self.wheel_file, True) | ||
|
||
ws = pkg_resources.WorkingSet() | ||
list(map(ws.add_entry, sys.path)) | ||
ws.add_entry(site.getusersitepackages()) | ||
pkg = ws.by_key["test-axle-2-libpython"] | ||
scheme = get_scheme("test-axle-2-libpython", True) | ||
|
||
prefix = scheme.purelib | ||
pth_file = basename(pkg.egg_info[:-len("dist-info")] + "pth") | ||
pth_path = jp(prefix, pth_file) | ||
dist_info = jp(prefix, basename(pkg.egg_info)) | ||
axle_done = jp(dist_info, "axle.done") | ||
|
||
self.assertTrue(exists(pth_path)) | ||
self.assertFalse(exists(axle_done)) | ||
|
||
site.addpackage(prefix, pth_file, None) | ||
|
||
self.assertFalse(exists(pth_path)) | ||
self.assertTrue(exists(axle_done)) | ||
|
||
self.check_installed_contents(scheme) | ||
|
||
self.uninstall(self.wheel_file) | ||
|
||
self.assertFalse(exists(dist_info)) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Binary file added
BIN
+3.2 KB
src/integrationtest/python/test_axle_2_libpython-0.0.1-py3-none-any.whl
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.