mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-05-08 12:30:44 +02:00
re-applied changes to dev-libs/libwrc
This commit is contained in:
parent
99e2331873
commit
68f53ac036
5 changed files with 399 additions and 0 deletions
2
dev-libs/libwrc/Manifest
Normal file
2
dev-libs/libwrc/Manifest
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
DIST libwrc-experimental-20220720.tar.gz 1817812 BLAKE2B 240d6dfbb6dcf95735d357ad745d4e6b17db4e58eaf71455dbfbaf3112ef5713c51b7f8a5dc8ced21547660e7e155f0ad3430e7c67f8fb7095bf0b7524752699 SHA512 0a28efaa997f8db7631feb1bd426708d230815afba04259397c13fc337be500318586461190ba2039ef4ffb9d68b7c7799af1dd4c88ba612e5b75790b756bd4c
|
||||
DIST libwrc-experimental-20221009.tar.gz 1810133 BLAKE2B 74ba2e4aa3b05839609cc494b0102dc677b672d24d9fede16edc7062d9c0d76d63aad553d0710ca8c22308cc22a43e6c42b842ad44f4d0e8c37698820ae746da SHA512 2a0e119c0ee4f877afb9c82ca393440c28192415397146ac7caf1cdc5564dbb8f623a74f5f28f1137022a0cf7d53c3a77fb7797c9ba35a4c474df048d81c270d
|
||||
245
dev-libs/libwrc/files/2022-11-pywrc_test_stream.py
Normal file
245
dev-libs/libwrc/files/2022-11-pywrc_test_stream.py
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Python-bindings stream type test script
|
||||
#
|
||||
# Copyright (C) 2011-2022, Joachim Metz <joachim.metz@gmail.com>
|
||||
#
|
||||
# Refer to AUTHORS for acknowledgements.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import pywrc
|
||||
|
||||
|
||||
class StreamTypeTests(unittest.TestCase):
|
||||
"""Tests the stream type."""
|
||||
|
||||
def test_signal_abort(self):
|
||||
"""Tests the signal_abort function."""
|
||||
wrc_stream = pywrc.stream()
|
||||
|
||||
wrc_stream.signal_abort()
|
||||
|
||||
def test_open(self):
|
||||
"""Tests the open function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
wrc_stream.open(test_source)
|
||||
|
||||
with self.assertRaises(IOError):
|
||||
wrc_stream.open(test_source)
|
||||
|
||||
wrc_stream.close()
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
wrc_stream.open(None)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
wrc_stream.open(test_source, mode="w")
|
||||
|
||||
def test_open_file_object(self):
|
||||
"""Tests the open_file_object function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
if not os.path.isfile(test_source):
|
||||
raise unittest.SkipTest("source not a regular file")
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
with open(test_source, "rb") as file_object:
|
||||
|
||||
wrc_stream.open_file_object(file_object)
|
||||
|
||||
with self.assertRaises(IOError):
|
||||
wrc_stream.open_file_object(file_object)
|
||||
|
||||
wrc_stream.close()
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
wrc_stream.open_file_object(None)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
wrc_stream.open_file_object(file_object, mode="w")
|
||||
|
||||
def test_close(self):
|
||||
"""Tests the close function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
|
||||
with self.assertRaises(IOError):
|
||||
wrc_stream.close()
|
||||
|
||||
def test_open_close(self):
|
||||
"""Tests the open and close functions."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
return
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
# Test open and close.
|
||||
wrc_stream.open(test_source)
|
||||
wrc_stream.close()
|
||||
|
||||
# Test open and close a second time to validate clean up on close.
|
||||
wrc_stream.open(test_source)
|
||||
wrc_stream.close()
|
||||
|
||||
if os.path.isfile(test_source):
|
||||
with open(test_source, "rb") as file_object:
|
||||
|
||||
# Test open_file_object and close.
|
||||
wrc_stream.open_file_object(file_object)
|
||||
wrc_stream.close()
|
||||
|
||||
# Test open_file_object and close a second time to validate clean up on close.
|
||||
wrc_stream.open_file_object(file_object)
|
||||
wrc_stream.close()
|
||||
|
||||
# Test open_file_object and close and dereferencing file_object.
|
||||
wrc_stream.open_file_object(file_object)
|
||||
del file_object
|
||||
wrc_stream.close()
|
||||
|
||||
def test_set_ascii_codepage(self):
|
||||
"""Tests the set_ascii_codepage function."""
|
||||
supported_codepages = (
|
||||
"ascii", "cp874", "cp932", "cp936", "cp949", "cp950", "cp1250",
|
||||
"cp1251", "cp1252", "cp1253", "cp1254", "cp1255", "cp1256", "cp1257",
|
||||
"cp1258")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
|
||||
for codepage in supported_codepages:
|
||||
wrc_stream.set_ascii_codepage(codepage)
|
||||
|
||||
unsupported_codepages = (
|
||||
"iso-8859-1", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5",
|
||||
"iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-9", "iso-8859-10",
|
||||
"iso-8859-11", "iso-8859-13", "iso-8859-14", "iso-8859-15",
|
||||
"iso-8859-16", "koi8_r", "koi8_u")
|
||||
|
||||
for codepage in unsupported_codepages:
|
||||
with self.assertRaises(RuntimeError):
|
||||
wrc_stream.set_ascii_codepage(codepage)
|
||||
|
||||
def test_get_ascii_codepage(self):
|
||||
"""Tests the get_ascii_codepage function and ascii_codepage property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
wrc_stream.open(test_source)
|
||||
|
||||
ascii_codepage = wrc_stream.get_ascii_codepage()
|
||||
self.assertIsNotNone(ascii_codepage)
|
||||
|
||||
self.assertIsNotNone(wrc_stream.ascii_codepage)
|
||||
|
||||
wrc_stream.close()
|
||||
|
||||
def test_get_virtual_address(self):
|
||||
"""Tests the get_virtual_address function and virtual_address property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
wrc_stream.open(test_source)
|
||||
|
||||
virtual_address = wrc_stream.get_virtual_address()
|
||||
self.assertIsNotNone(virtual_address)
|
||||
|
||||
self.assertIsNotNone(wrc_stream.virtual_address)
|
||||
|
||||
wrc_stream.close()
|
||||
|
||||
def test_get_number_of_resources(self):
|
||||
"""Tests the get_number_of_resources function and number_of_resources property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
if unittest.virtual_address is None:
|
||||
raise unittest.SkipTest("missing virtual address")
|
||||
|
||||
wrc_stream = pywrc.stream()
|
||||
wrc_stream.set_virtual_address(unittest.virtual_address)
|
||||
|
||||
wrc_stream.open(test_source)
|
||||
|
||||
number_of_resources = wrc_stream.get_number_of_resources()
|
||||
self.assertIsNotNone(number_of_resources)
|
||||
|
||||
self.assertIsNotNone(wrc_stream.number_of_resources)
|
||||
|
||||
wrc_stream.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
argument_parser = argparse.ArgumentParser()
|
||||
|
||||
argument_parser.add_argument(
|
||||
"-v", "--virtual_address", "--virtual-address", dest="virtual_address",
|
||||
action="store", default=None, type=int, help=(
|
||||
"virtual address of the source file."))
|
||||
|
||||
argument_parser.add_argument(
|
||||
"source", nargs="?", action="store", metavar="PATH",
|
||||
default=None, help="path of the source file.")
|
||||
|
||||
options, unknown_options = argument_parser.parse_known_args()
|
||||
unknown_options.insert(0, sys.argv[0])
|
||||
|
||||
setattr(unittest, "virtual_address", options.virtual_address)
|
||||
setattr(unittest, "source", options.source)
|
||||
|
||||
unittest.main(argv=unknown_options, verbosity=2)
|
||||
72
dev-libs/libwrc/libwrc-20220720.ebuild
Normal file
72
dev-libs/libwrc/libwrc-20220720.ebuild
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
inherit autotools python-single-r1
|
||||
|
||||
DESCRIPTION="Library to access the Windows Resource Compiler (WRC) format"
|
||||
HOMEPAGE="https://github.com/libyal/libwrc"
|
||||
SRC_URI="https://github.com/libyal/libwrc/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 x86"
|
||||
IUSE="nls unicode python +threads debug"
|
||||
|
||||
REQUIRED_USE="
|
||||
python? ( ${PYTHON_REQUIRED_USE} )
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
nls? (
|
||||
virtual/libiconv
|
||||
virtual/libintl
|
||||
)
|
||||
python? ( dev-lang/python:* )
|
||||
app-forensics/libbfio[nls=,unicode=,threads=]
|
||||
dev-libs/libcdata[nls=]
|
||||
dev-libs/libcerror[nls=]
|
||||
dev-libs/libcfile[nls=,unicode=]
|
||||
dev-libs/libclocale[nls=,unicode=]
|
||||
dev-libs/libcnotify[nls=]
|
||||
dev-libs/libcpath[nls=,unicode=]
|
||||
dev-libs/libcsplit[nls=,unicode=]
|
||||
dev-libs/libcthreads[nls=]
|
||||
app-forensics/libexe[nls=,unicode=,threads=,python=]
|
||||
dev-libs/libfcache[nls=]
|
||||
dev-libs/libfdata[nls=,threads=]
|
||||
dev-libs/libfdatetime[nls=]
|
||||
dev-libs/libfguid[nls=]
|
||||
dev-libs/libfvalue[nls=]
|
||||
dev-libs/libfwnt[nls=,threads=,python=]
|
||||
dev-libs/libuna[nls=,unicode=]
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
python? ( ${PYTHON_DEPS} )
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
# workaround for missing files in distribution package, see https://github.com/libyal/libwrc/issues/1
|
||||
# should not be required any more in releases after 20221009
|
||||
cp "${FILESDIR}/2022-11-pywrc_test_stream.py" "${WORKDIR}/${P}/tests/pywrc_test_stream.py"
|
||||
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
$(use_enable nls) \
|
||||
$(use_with nls libiconv-prefix) \
|
||||
$(use_with nls libintl-prefix) \
|
||||
$(use_enable unicode wide-character-type) \
|
||||
$(use_enable debug verbose-output ) \
|
||||
$(use_enable debug debug-output ) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable python) \
|
||||
$(use_enable python python3) \
|
||||
|
||||
}
|
||||
72
dev-libs/libwrc/libwrc-20221009.ebuild
Normal file
72
dev-libs/libwrc/libwrc-20221009.ebuild
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
inherit autotools python-single-r1
|
||||
|
||||
DESCRIPTION="Library to access the Windows Resource Compiler (WRC) format"
|
||||
HOMEPAGE="https://github.com/libyal/libwrc"
|
||||
SRC_URI="https://github.com/libyal/libwrc/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 x86"
|
||||
IUSE="nls unicode python +threads debug"
|
||||
|
||||
REQUIRED_USE="
|
||||
python? ( ${PYTHON_REQUIRED_USE} )
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
nls? (
|
||||
virtual/libiconv
|
||||
virtual/libintl
|
||||
)
|
||||
python? ( dev-lang/python:* )
|
||||
app-forensics/libbfio[nls=,unicode=,threads=]
|
||||
dev-libs/libcdata[nls=]
|
||||
dev-libs/libcerror[nls=]
|
||||
dev-libs/libcfile[nls=,unicode=]
|
||||
dev-libs/libclocale[nls=,unicode=]
|
||||
dev-libs/libcnotify[nls=]
|
||||
dev-libs/libcpath[nls=,unicode=]
|
||||
dev-libs/libcsplit[nls=,unicode=]
|
||||
dev-libs/libcthreads[nls=]
|
||||
app-forensics/libexe[nls=,unicode=,threads=,python=]
|
||||
dev-libs/libfcache[nls=]
|
||||
dev-libs/libfdata[nls=,threads=]
|
||||
dev-libs/libfdatetime[nls=]
|
||||
dev-libs/libfguid[nls=]
|
||||
dev-libs/libfvalue[nls=]
|
||||
dev-libs/libfwnt[nls=,threads=,python=]
|
||||
dev-libs/libuna[nls=,unicode=]
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
python? ( ${PYTHON_DEPS} )
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
# workaround for missing files in distribution package, see https://github.com/libyal/libwrc/issues/1
|
||||
# should not be required any more in releases after 20221009
|
||||
cp "${FILESDIR}/2022-11-pywrc_test_stream.py" "${WORKDIR}/${P}/tests/pywrc_test_stream.py"
|
||||
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
$(use_enable nls) \
|
||||
$(use_with nls libiconv-prefix) \
|
||||
$(use_with nls libintl-prefix) \
|
||||
$(use_enable unicode wide-character-type) \
|
||||
$(use_enable debug verbose-output ) \
|
||||
$(use_enable debug debug-output ) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable python) \
|
||||
$(use_enable python python3) \
|
||||
|
||||
}
|
||||
8
dev-libs/libwrc/metadata.xml
Normal file
8
dev-libs/libwrc/metadata.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>unknown@pentoo.ch</email>
|
||||
<name>Author Unknown</name>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
||||
Loading…
Reference in a new issue