Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Exclude bpm archives
|
||||||
|
*.bpm
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Github repository
|
||||||
|
REPO="ahupp/python-magic"
|
||||||
|
|
||||||
|
# Get tag name using Github Rest API
|
||||||
|
TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/tags | jq -r '.[0].name')
|
||||||
|
|
||||||
|
echo "$TAG_NAME"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: python-magic
|
||||||
|
description: A python wrapper for libmagic
|
||||||
|
version: 0.4.27
|
||||||
|
revision: 1
|
||||||
|
url: https://github.com/ahupp/python-magic
|
||||||
|
license: MIT
|
||||||
|
architecture: any
|
||||||
|
output_architecture: any
|
||||||
|
type: source
|
||||||
|
depends:
|
||||||
|
- file
|
||||||
|
- python3
|
||||||
|
make_depends:
|
||||||
|
- python-build
|
||||||
|
- python-installer
|
||||||
|
- python-setuptools
|
||||||
|
- python-wheel
|
||||||
|
- python-pytest
|
||||||
|
downloads:
|
||||||
|
- url: https://github.com/ahupp/python-magic/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz
|
||||||
|
extract_to: ${BPM_SOURCE}
|
||||||
|
extract_strip_components: 1
|
||||||
|
checksum: 3978a25d43d9a7b8a89ae9d726bd4962fc90dc4f69ae852e399f3c56d4b0bd63
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
From 545a2a561522efc2869066792062694b59b1b39c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dominique Leuenberger <[email protected]>
|
||||||
|
Date: Wed, 2 Aug 2023 11:29:47 +0200
|
||||||
|
Subject: [PATCH] Fix test suite with file 5.45
|
||||||
|
|
||||||
|
[ 12s] test/python_magic_test.py:53: in assert_values
|
||||||
|
[ 12s] self.assertIn(value, expected_value)
|
||||||
|
[ 12s] E AssertionError: 'PDF document, version 1.2, 2 page(s)' not found in ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')
|
||||||
|
---
|
||||||
|
test/libmagic_test.py | 2 +-
|
||||||
|
test/python_magic_test.py | 3 ++-
|
||||||
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/test/libmagic_test.py b/test/libmagic_test.py
|
||||||
|
index 5719a58..7b4665b 100644
|
||||||
|
--- a/test/libmagic_test.py
|
||||||
|
+++ b/test/libmagic_test.py
|
||||||
|
@@ -15,7 +15,7 @@ class MagicTestCase(unittest.TestCase):
|
||||||
|
filename = os.path.join(TESTDATA_DIR, 'test.pdf')
|
||||||
|
expected_mime_type = 'application/pdf'
|
||||||
|
expected_encoding = 'us-ascii'
|
||||||
|
- expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')
|
||||||
|
+ expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages', 'PDF document, version 1.2, 2 page(s)')
|
||||||
|
|
||||||
|
def assert_result(self, result):
|
||||||
|
self.assertEqual(result.mime_type, self.expected_mime_type)
|
||||||
|
diff --git a/test/python_magic_test.py b/test/python_magic_test.py
|
||||||
|
index d51587c..410a149 100755
|
||||||
|
--- a/test/python_magic_test.py
|
||||||
|
+++ b/test/python_magic_test.py
|
||||||
|
@@ -108,7 +108,8 @@ def test_descriptions(self):
|
||||||
|
self.assert_values(m, {
|
||||||
|
'magic._pyc_': 'python 2.4 byte-compiled',
|
||||||
|
'test.pdf': ('PDF document, version 1.2',
|
||||||
|
- 'PDF document, version 1.2, 2 pages'),
|
||||||
|
+ 'PDF document, version 1.2, 2 pages',
|
||||||
|
+ 'PDF document, version 1.2, 2 page(s)'),
|
||||||
|
'test.gz':
|
||||||
|
('gzip compressed data, was "test", from Unix, last '
|
||||||
|
'modified: Sun Jun 29 01:32:52 2008',
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||||
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||||
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||||
|
|
||||||
|
# The prepare function is executed in the root of the temp directory
|
||||||
|
# This function is used for putting downloaded files to the correct location or applying patches
|
||||||
|
prepare() {
|
||||||
|
cd "$BPM_SOURCE"
|
||||||
|
patch -Np1 -i "$BPM_WORKDIR"/fix-test-suite.patch
|
||||||
|
}
|
||||||
|
|
||||||
|
# The build function is executed in the source directory
|
||||||
|
# This function is used to compile the source code
|
||||||
|
build() {
|
||||||
|
python3 -m build --wheel --no-isolation .
|
||||||
|
}
|
||||||
|
|
||||||
|
# The check function is executed in the source directory
|
||||||
|
# This function is used to run tests to verify the package has been compiled correctly
|
||||||
|
check() {
|
||||||
|
LC_ALL=en_US.UTF-8 pytest --deselect test/python_magic_test.py::MagicTest::test_extension
|
||||||
|
}
|
||||||
|
|
||||||
|
# The package function is executed in the source directory
|
||||||
|
# This function is used to move the compiled files into the output directory
|
||||||
|
package() {
|
||||||
|
python3 -m installer --destdir="$BPM_OUTPUT" dist/*.whl
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/python-magic/LICENSE
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user