mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-06 08:25:01 +01:00
libewf: 20240506 bump
This commit is contained in:
parent
daa50d640b
commit
78871f5748
20 changed files with 50 additions and 1260 deletions
|
|
@ -1,2 +1 @@
|
|||
DIST libewf-experimental-20201230.tar.gz 2582683 BLAKE2B 3dd866114516674e303527b752dadc12f3979c402ec1bb6125a94d09fe288565ad8f962b4bedc19d135f503e87141a2ba61ad18e34d087dc2b19f577ca9c4b9b SHA512 ccff3f15e3e457eb7f2c8fd6e92f44908ef0725ae60804bb079d3986483a6176d56741e0dcfe4ef1bf69fd0aa573ea6e880766660ea066beeb17c62c8a8a2d8e
|
||||
DIST libewf-experimental-20230212.tar.gz 2638562 BLAKE2B 207a17b9d9cf91bb6fb2170cbd81a8b2d87c39d799e5d706aedcd80cdf7c9bd7fbcbe8eae07547ea57d4b9d5a44c0e18c516abbaffe0ce4b731a72dad17fd100 SHA512 a362c394e694d17bf5e0a30df5442c7f372b5db14ffcd898a9ea20b983e74fb219309657206fca97df1a127bef6fe6e556320191682e1c25ea7bbc1fb349ff2a
|
||||
DIST libewf-experimental-20240506.tar.gz 2757456 BLAKE2B 55e525fc147a5bf161dda086d3d8e4662db7ad58a4ca15bbbb3f6a780a65c53c83a7f63da825ed401a12b64587952a4592f2dfa1d01bf2df30bb77c16c42dac5 SHA512 373207c2795b820374dd2071145345966e65bc31d2f0679f1ecb759cea2b7e0802935c66e8bec9dd6e76c944e1ba4a616ed2de216cdad78934855d2355ae08bd
|
||||
|
|
|
|||
|
|
@ -1,656 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Python-bindings handle type test script
|
||||
#
|
||||
# Copyright (C) 2006-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 random
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import pyewf
|
||||
|
||||
|
||||
class HandleTypeTests(unittest.TestCase):
|
||||
"""Tests the handle type."""
|
||||
|
||||
def test_signal_abort(self):
|
||||
"""Tests the signal_abort function."""
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.signal_abort()
|
||||
|
||||
def test_open(self):
|
||||
"""Tests the open function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
# TODO: fix
|
||||
# with self.assertRaises(IOError):
|
||||
# ewf_handle.open(filenames)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
ewf_handle.open(None)
|
||||
|
||||
def test_open_file_objects(self):
|
||||
"""Tests the open_file_objects 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")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
file_objects = [open(filename, "rb") for filename in filenames]
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open_file_objects(file_objects)
|
||||
|
||||
# TODO: change IOError into IOError
|
||||
with self.assertRaises(MemoryError):
|
||||
ewf_handle.open_file_objects(file_objects)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
ewf_handle.open_file_objects(None)
|
||||
|
||||
for file_object in file_objects:
|
||||
file_object.close()
|
||||
|
||||
def test_close(self):
|
||||
"""Tests the close function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
# TODO: fix
|
||||
# with self.assertRaises(IOError):
|
||||
# ewf_handle.close()
|
||||
|
||||
def test_open_close(self):
|
||||
"""Tests the open and close functions."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
return
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
# Test open and close.
|
||||
ewf_handle.open(filenames)
|
||||
ewf_handle.close()
|
||||
|
||||
# Test open and close a second time to validate clean up on close.
|
||||
ewf_handle.open(filenames)
|
||||
ewf_handle.close()
|
||||
|
||||
if os.path.isfile(test_source):
|
||||
with open(test_source, "rb") as file_object:
|
||||
|
||||
# Test open_file_objects and close.
|
||||
ewf_handle.open_file_objects([file_object])
|
||||
ewf_handle.close()
|
||||
|
||||
# Test open_file_objects and close a second time to validate clean up on close.
|
||||
ewf_handle.open_file_objects([file_object])
|
||||
ewf_handle.close()
|
||||
|
||||
# Test open_file_objects and close and dereferencing file_object.
|
||||
ewf_handle.open_file_objects([file_object])
|
||||
del file_object
|
||||
ewf_handle.close()
|
||||
|
||||
def test_read_buffer(self):
|
||||
"""Tests the read_buffer function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_size = ewf_handle.get_media_size()
|
||||
|
||||
if media_size < 4096:
|
||||
# Test read without maximum size.
|
||||
ewf_handle.seek_offset(0, os.SEEK_SET)
|
||||
|
||||
data = ewf_handle.read_buffer()
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), media_size)
|
||||
|
||||
# Test read with maximum size.
|
||||
ewf_handle.seek_offset(0, os.SEEK_SET)
|
||||
|
||||
data = ewf_handle.read_buffer(size=4096)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), min(media_size, 4096))
|
||||
|
||||
if media_size > 8:
|
||||
ewf_handle.seek_offset(-8, os.SEEK_END)
|
||||
|
||||
# Read buffer on media_size boundary.
|
||||
data = ewf_handle.read_buffer(size=4096)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), 8)
|
||||
|
||||
# Read buffer beyond media_size boundary.
|
||||
data = ewf_handle.read_buffer(size=4096)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), 0)
|
||||
|
||||
# Stress test read buffer.
|
||||
ewf_handle.seek_offset(0, os.SEEK_SET)
|
||||
|
||||
remaining_media_size = media_size
|
||||
|
||||
for _ in range(1024):
|
||||
read_size = int(random.random() * 4096)
|
||||
|
||||
data = ewf_handle.read_buffer(size=read_size)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
|
||||
data_size = len(data)
|
||||
|
||||
if read_size > remaining_media_size:
|
||||
read_size = remaining_media_size
|
||||
|
||||
self.assertEqual(data_size, read_size)
|
||||
|
||||
remaining_media_size -= data_size
|
||||
|
||||
if not remaining_media_size:
|
||||
ewf_handle.seek_offset(0, os.SEEK_SET)
|
||||
|
||||
remaining_media_size = media_size
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ewf_handle.read_buffer(size=-1)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
# Test the read without open.
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.read_buffer(size=4096)
|
||||
|
||||
def test_read_buffer_file_object(self):
|
||||
"""Tests the read_buffer function on a file-like object."""
|
||||
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")
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
with open(test_source, "rb") as file_object:
|
||||
ewf_handle.open_file_objects([file_object])
|
||||
|
||||
media_size = ewf_handle.get_media_size()
|
||||
|
||||
# Test normal read.
|
||||
data = ewf_handle.read_buffer(size=4096)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), min(media_size, 4096))
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_read_buffer_at_offset(self):
|
||||
"""Tests the read_buffer_at_offset function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_size = ewf_handle.get_media_size()
|
||||
|
||||
# Test normal read.
|
||||
data = ewf_handle.read_buffer_at_offset(4096, 0)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), min(media_size, 4096))
|
||||
|
||||
if media_size > 8:
|
||||
# Read buffer on media_size boundary.
|
||||
data = ewf_handle.read_buffer_at_offset(4096, media_size - 8)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), 8)
|
||||
|
||||
# Read buffer beyond media_size boundary.
|
||||
data = ewf_handle.read_buffer_at_offset(4096, media_size + 8)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertEqual(len(data), 0)
|
||||
|
||||
# Stress test read buffer.
|
||||
for _ in range(1024):
|
||||
random_number = random.random()
|
||||
|
||||
media_offset = int(random_number * media_size)
|
||||
read_size = int(random_number * 4096)
|
||||
|
||||
data = ewf_handle.read_buffer_at_offset(read_size, media_offset)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
|
||||
remaining_media_size = media_size - media_offset
|
||||
|
||||
data_size = len(data)
|
||||
|
||||
if read_size > remaining_media_size:
|
||||
read_size = remaining_media_size
|
||||
|
||||
self.assertEqual(data_size, read_size)
|
||||
|
||||
remaining_media_size -= data_size
|
||||
|
||||
if not remaining_media_size:
|
||||
ewf_handle.seek_offset(0, os.SEEK_SET)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ewf_handle.read_buffer_at_offset(-1, 0)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
ewf_handle.read_buffer_at_offset(4096, -1)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
# Test the read without open.
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.read_buffer_at_offset(4096, 0)
|
||||
|
||||
def test_seek_offset(self):
|
||||
"""Tests the seek_offset function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_size = ewf_handle.get_media_size()
|
||||
|
||||
ewf_handle.seek_offset(16, os.SEEK_SET)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, 16)
|
||||
|
||||
ewf_handle.seek_offset(16, os.SEEK_CUR)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, 32)
|
||||
|
||||
ewf_handle.seek_offset(-16, os.SEEK_CUR)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, 16)
|
||||
|
||||
if media_size > 16:
|
||||
ewf_handle.seek_offset(-16, os.SEEK_END)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, media_size - 16)
|
||||
|
||||
ewf_handle.seek_offset(16, os.SEEK_END)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, media_size + 16)
|
||||
|
||||
# TODO: change IOError into ValueError
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.seek_offset(-1, os.SEEK_SET)
|
||||
|
||||
# TODO: change IOError into ValueError
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.seek_offset(-32 - media_size, os.SEEK_CUR)
|
||||
|
||||
# TODO: change IOError into ValueError
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.seek_offset(-32 - media_size, os.SEEK_END)
|
||||
|
||||
# TODO: change IOError into ValueError
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.seek_offset(0, -1)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
# Test the seek without open.
|
||||
with self.assertRaises(IOError):
|
||||
ewf_handle.seek_offset(16, os.SEEK_SET)
|
||||
|
||||
def test_seek_offset_file_object(self):
|
||||
"""Tests the seek_offset function on a file-like object."""
|
||||
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")
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
with open(test_source, "rb") as file_object:
|
||||
ewf_handle.open_file_objects([file_object])
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, 0)
|
||||
|
||||
ewf_handle.seek_offset(16, os.SEEK_SET)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertEqual(offset, 16)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_offset(self):
|
||||
"""Tests the get_offset function."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
offset = ewf_handle.get_offset()
|
||||
self.assertIsNotNone(offset)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_root_file_entry(self):
|
||||
"""Tests the get_root_file_entry function and root_file_entry property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
# TODO: check media type and skip if not LEF
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
# root_file_entry = ewf_handle.get_root_file_entry()
|
||||
# self.assertIsNotNone(root_file_entry)
|
||||
|
||||
# self.assertIsNotNone(ewf_handle.root_file_entry)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_sectors_per_chunk(self):
|
||||
"""Tests the get_sectors_per_chunk function and sectors_per_chunk property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
sectors_per_chunk = ewf_handle.get_sectors_per_chunk()
|
||||
self.assertIsNotNone(sectors_per_chunk)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.sectors_per_chunk)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_bytes_per_sector(self):
|
||||
"""Tests the get_bytes_per_sector function and bytes_per_sector property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
bytes_per_sector = ewf_handle.get_bytes_per_sector()
|
||||
self.assertIsNotNone(bytes_per_sector)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.bytes_per_sector)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_number_of_sectors(self):
|
||||
"""Tests the get_number_of_sectors function and number_of_sectors property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
number_of_sectors = ewf_handle.get_number_of_sectors()
|
||||
self.assertIsNotNone(number_of_sectors)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.number_of_sectors)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_chunk_size(self):
|
||||
"""Tests the get_chunk_size function and chunk_size property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
chunk_size = ewf_handle.get_chunk_size()
|
||||
self.assertIsNotNone(chunk_size)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.chunk_size)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_error_granularity(self):
|
||||
"""Tests the get_error_granularity function and error_granularity property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
error_granularity = ewf_handle.get_error_granularity()
|
||||
self.assertIsNotNone(error_granularity)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.error_granularity)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_compression_method(self):
|
||||
"""Tests the get_compression_method function and compression_method property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
compression_method = ewf_handle.get_compression_method()
|
||||
self.assertIsNotNone(compression_method)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.compression_method)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_media_size(self):
|
||||
"""Tests the get_media_size function and media_size property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_size = ewf_handle.get_media_size()
|
||||
self.assertIsNotNone(media_size)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.media_size)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_media_type(self):
|
||||
"""Tests the get_media_type function and media_type property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_type = ewf_handle.get_media_type()
|
||||
self.assertIsNotNone(media_type)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.media_type)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_media_flags(self):
|
||||
"""Tests the get_media_flags function and media_flags property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
media_flags = ewf_handle.get_media_flags()
|
||||
self.assertIsNotNone(media_flags)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.media_flags)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_format(self):
|
||||
"""Tests the get_format function and format property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
format = ewf_handle.get_format()
|
||||
self.assertIsNotNone(format)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.format)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
def test_get_header_codepage(self):
|
||||
"""Tests the get_header_codepage function and header_codepage property."""
|
||||
test_source = unittest.source
|
||||
if not test_source:
|
||||
raise unittest.SkipTest("missing source")
|
||||
|
||||
filenames = pyewf.glob(test_source)
|
||||
|
||||
ewf_handle = pyewf.handle()
|
||||
|
||||
ewf_handle.open(filenames)
|
||||
|
||||
header_codepage = ewf_handle.get_header_codepage()
|
||||
self.assertIsNotNone(header_codepage)
|
||||
|
||||
self.assertIsNotNone(ewf_handle.header_codepage)
|
||||
|
||||
ewf_handle.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
argument_parser = argparse.ArgumentParser()
|
||||
|
||||
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, "source", options.source)
|
||||
|
||||
unittest.main(argv=unknown_options, verbosity=2)
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
inherit autotools python-single-r1
|
||||
|
||||
DESCRIPTION="Libewf is a library to access the Expert Witness Compression Format (EWF)"
|
||||
HOMEPAGE="https://github.com/libyal/libewf"
|
||||
SRC_URI="https://github.com/libyal/libewf/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 x86"
|
||||
IUSE="nls unicode python +fuse +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/libcaes[nls=,python=]
|
||||
dev-libs/libcdata[nls=]
|
||||
dev-libs/libcdatetime[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=]
|
||||
dev-libs/libfcache[nls=]
|
||||
dev-libs/libfdata[nls=,threads=]
|
||||
dev-libs/libfdatetime[nls=]
|
||||
dev-libs/libfguid[nls=]
|
||||
dev-libs/libfvalue[nls=]
|
||||
dev-libs/libhmac[nls=,unicode=,threads=]
|
||||
app-forensics/libodraw[nls=,unicode=,threads=]
|
||||
dev-libs/libsmdev[nls=,unicode=,threads=,python=]
|
||||
app-forensics/libsmraw[nls=,unicode=,threads=,python=,fuse=]
|
||||
dev-libs/libuna[nls=,unicode=]
|
||||
sys-libs/zlib
|
||||
app-arch/bzip2
|
||||
sys-apps/util-linux
|
||||
dev-libs/openssl
|
||||
"
|
||||
# sys-apps/util-linux is for libuuid
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
python? ( ${PYTHON_DEPS} )
|
||||
fuse? ( sys-fs/fuse )
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
# workaround for missing files in distribution package, see https://github.com/libyal/libewf/issues/174
|
||||
# should not be required any more in releases after 20201230
|
||||
cp "${FILESDIR}/2022-11-pyewf_test_handle.py" "${WORKDIR}/${P}/tests/pyewf_test_handle.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) \
|
||||
$(use_with fuse libfuse) \
|
||||
|
||||
}
|
||||
|
||||
src_test() {
|
||||
ewarn "After running test_library.sh, the process will apparently stop running."
|
||||
ewarn "This is due to a long-running test named test_glob.sh that may take a minute to complete."
|
||||
default_src_test
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
# see https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
inherit autotools python-single-r1
|
||||
inherit python-single-r1
|
||||
|
||||
DESCRIPTION="Libewf is a library to access the Expert Witness Compression Format (EWF)"
|
||||
HOMEPAGE="https://github.com/libyal/libewf"
|
||||
|
|
@ -58,15 +58,6 @@ RDEPEND="
|
|||
fuse? ( sys-fs/fuse:0 )
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
# workaround for missing files in distribution package, see https://github.com/libyal/libewf/issues/174
|
||||
# should not be required any more in releases after 20201230
|
||||
cp "${FILESDIR}/2022-11-pyewf_test_handle.py" "${WORKDIR}/${P}/tests/pyewf_test_handle.py"
|
||||
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
$(use_enable nls) \
|
||||
|
|
@ -77,9 +68,7 @@ src_configure() {
|
|||
$(use_enable debug debug-output ) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable python) \
|
||||
$(use_enable python python3) \
|
||||
$(use_with fuse libfuse) \
|
||||
|
||||
$(use_with fuse libfuse)
|
||||
}
|
||||
|
||||
src_test() {
|
||||
|
|
@ -8,4 +8,7 @@
|
|||
<use>
|
||||
<flag name="fuse">Enable FUSE support</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">libyal/libewf</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
DIST libodraw-alpha-20190118.tar.gz 1375806 BLAKE2B 17757b6f216b898ed6d45fd50133357948b2a415132df5bee5aa3d68f69338b51e03f03e6e3ad3ad73636d1ed03dc3d198be5721383c93a0694874a00b2dba48 SHA512 db7e44867d75c8742bbc1655d6c7cdfbf27542bff2bcca32bb2bebaedaa6f98488fd9fe2f20d4d652a6f39c9aff8cc4805dbbb07661e1c90a913396a9d39e708
|
||||
DIST libodraw-alpha-20201003.tar.gz 1433018 BLAKE2B d59782b5b640b98dcc74af84aac58372da688e336e2569764993f8c9af48a28322effdf45a399dbfa294edcff56f0ace32e0620ac75254fe3b1fb7ca5211797e SHA512 75a33e215f3fded78743d863c79a5aaffd0f4074f2bebca5fceedae324745ceb92c1d38beecd2f20be5f304b2f8fe901ae22e9a9fb6cc868e09c983d13d636d7
|
||||
DIST libodraw-alpha-20240505.tar.gz 1606123 BLAKE2B d32d9d7979a65ee8e4e5bd0b3235421bd55ef33881f9c98d13f02ac3dbee0db9ca3367a9c80b4163b3a1efc7593d5fe64617174a7415712999f89e5ed0689222 SHA512 6bffc9e2ba8c34f8330e4bd2ad581dfb3380a563c1a45da3976eefc9cc0086cdd038e6bd4e6d36c986840b1874ae361eac1d681c5982d54a84005c9b50e586d9
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools
|
||||
|
||||
DESCRIPTION="Library and tools to access to optical disc (split) RAW image files"
|
||||
HOMEPAGE="https://github.com/libyal/libodraw"
|
||||
SRC_URI="https://github.com/libyal/libodraw/releases/download/${PV}/${PN}-alpha-${PV}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 x86"
|
||||
IUSE="nls unicode +threads debug"
|
||||
|
||||
DEPEND="
|
||||
nls? (
|
||||
virtual/libiconv
|
||||
virtual/libintl
|
||||
)
|
||||
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=]
|
||||
dev-libs/libhmac[nls=,unicode=,threads=]
|
||||
dev-libs/libuna[nls=,unicode=]
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
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) \
|
||||
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
# see https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools
|
||||
|
||||
DESCRIPTION="Library and tools to access to optical disc (split) RAW image files"
|
||||
HOMEPAGE="https://github.com/libyal/libodraw"
|
||||
SRC_URI="https://github.com/libyal/libodraw/releases/download/${PV}/${PN}-alpha-${PV}.tar.gz"
|
||||
|
|
@ -35,10 +33,10 @@ RDEPEND="
|
|||
${DEPEND}
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
#src_prepare() {
|
||||
# eautoreconf
|
||||
# eapply_user
|
||||
#}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
|
|
@ -48,7 +46,7 @@ src_configure() {
|
|||
$(use_enable unicode wide-character-type) \
|
||||
$(use_enable debug verbose-output ) \
|
||||
$(use_enable debug debug-output ) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable threads multi-threading-support)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -5,4 +5,7 @@
|
|||
<email>unknown@pentoo.ch</email>
|
||||
<name>Author Unknown</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">libyal/libodraw</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
DIST libfvalue-experimental-20201124.tar.gz 1270349 BLAKE2B 39adefec3602ac459a35536bf229a1f255f962dfce987d80294c6ed630d948a1bd34e0c6fa02656c3bba8cd7cb3c33d84fd29fafe0e58396e1fcbcc7ccaa5b60 SHA512 8772020e6ea9b10a31ed4fe800297138a54e3a9dbb2e8a0dbe1b21fa8307f5df30db21570f89cdcb83fe3b8ae320fa1aeaa9e66848da2adde6f2d2f8886c2f1d
|
||||
DIST libfvalue-experimental-20220120.tar.gz 1294430 BLAKE2B 8fd0ef033bf182cf4803ed1189ba53150a9a2200e3c49196d169178ef502889d34da38e2b771bdce722a36a2acde05cd21abcfb5ffef5ca084a81ca75427f721 SHA512 6b363be7a4ce4ccfbff5e7fbb7bcd9c0433f81dcd53571fe17975404c40ef55147fd610aff8ee89633f09a672a60d132b46994ec365ed01af2293105602fc0ca
|
||||
DIST libfvalue-experimental-20240415.tar.gz 1321529 BLAKE2B d0c28289b52e73192f148ec01780e445e0011f904a216543727182e9e94fae1df2fc73682fea167e43c1f819217079018beead0dcde5da0179e23ec5cc38ce34 SHA512 288313dda46b7d53cee0d76a903d71f43f9f33a815058f2ce21ad464fceda48375c93ab80e4ba1ba7dfd4ac56e1327c9b4b4150365a690514325619799765afc
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools
|
||||
|
||||
DESCRIPTION="Library for generic file value functions"
|
||||
HOMEPAGE="https://github.com/libyal/libfvalue"
|
||||
SRC_URI="https://github.com/libyal/libfvalue/releases/download/${PV}/${PN}-experimental-${PV}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 x86"
|
||||
IUSE="nls debug +threads"
|
||||
|
||||
DEPEND="
|
||||
dev-libs/libcdata[nls=]
|
||||
dev-libs/libcerror[nls=]
|
||||
dev-libs/libcnotify[nls=]
|
||||
dev-libs/libcthreads[nls=]
|
||||
dev-libs/libfdatetime[nls=]
|
||||
dev-libs/libfguid[nls=]
|
||||
dev-libs/libfwnt[nls=]
|
||||
dev-libs/libuna[nls=]
|
||||
nls? (
|
||||
virtual/libiconv
|
||||
virtual/libintl
|
||||
)
|
||||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_prepare() {
|
||||
#makefile was created with 1.16, let's regenerate it
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
$(use_enable nls) \
|
||||
$(use_with nls libiconv-prefix) \
|
||||
$(use_with nls libintl-prefix) \
|
||||
$(use_enable debug debug-output) \
|
||||
$(use_enable debug verbose-output) \
|
||||
$(use_enable threads multi-threading-support)
|
||||
|
||||
# --disable-shared-libs disable shared library support
|
||||
# not supported in the ebuild at the moment - kind of defeats the entire process
|
||||
|
||||
# --enable-winapi enable WINAPI support for cross-compilation
|
||||
# [default=auto-detect]
|
||||
# not supported in the ebuild at the moment - requires windows.h, does not make much sense for us
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
# see https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools
|
||||
#inherit autotools
|
||||
|
||||
DESCRIPTION="Library for generic file value functions"
|
||||
HOMEPAGE="https://github.com/libyal/libfvalue"
|
||||
|
|
@ -30,11 +30,11 @@ DEPEND="
|
|||
"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
src_prepare() {
|
||||
#src_prepare() {
|
||||
#makefile was created with 1.16, let's regenerate it
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
# eautoreconf
|
||||
# eapply_user
|
||||
#}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
|
|
@ -5,4 +5,7 @@
|
|||
<email>unknown@pentoo.ch</email>
|
||||
<name>Author Unknown</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">libyal/libfvalue</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
inherit python-single-r1 autotools
|
||||
inherit python-single-r1
|
||||
|
||||
DESCRIPTION="Library for Windows NT data types"
|
||||
HOMEPAGE="https://github.com/libyal/libfwnt"
|
||||
|
|
@ -34,20 +34,6 @@ RDEPEND="
|
|||
python? ( ${PYTHON_DEPS} )
|
||||
"
|
||||
|
||||
CMAKE_IN_SOURCE_BUILD=1
|
||||
|
||||
src_prepare() {
|
||||
# workaround for missing files in distribution package, see https://github.com/libyal/libfwnt/issues/12
|
||||
# should not be required any more in releases after 20220922
|
||||
cp "${FILESDIR}/2022-11-pyfwnt_test_access_control_entry.py" "${WORKDIR}/${P}/tests/pyfwnt_test_access_control_entry.py"
|
||||
cp "${FILESDIR}/2022-11-pyfwnt_test_access_control_list.py" "${WORKDIR}/${P}/tests/pyfwnt_test_access_control_list.py"
|
||||
cp "${FILESDIR}/2022-11-pyfwnt_test_lzx.py" "${WORKDIR}/${P}/tests/pyfwnt_test_lzx.py"
|
||||
|
||||
#makefile was created with 1.16, let's regenerate it
|
||||
eautoreconf
|
||||
eapply_user
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf \
|
||||
$(use_enable nls) \
|
||||
|
|
@ -56,8 +42,8 @@ src_configure() {
|
|||
$(use_enable debug verbose-output) \
|
||||
$(use_enable debug debug-output) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable python) \
|
||||
$(use_enable python python3)
|
||||
$(use_enable python)
|
||||
# $(use_enable python python3)
|
||||
|
||||
# --disable-shared-libs disable shared library support
|
||||
# not supported in the ebuild at the moment - kind of defeats the entire process
|
||||
|
|
|
|||
11
dev-libs/libfwnt/metadata.xml
Normal file
11
dev-libs/libfwnt/metadata.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?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>
|
||||
<upstream>
|
||||
<remote-id type="github">libyal/libfwnt</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
@ -1,2 +1 @@
|
|||
DIST libwrc-experimental-20220720.tar.gz 1817812 BLAKE2B 240d6dfbb6dcf95735d357ad745d4e6b17db4e58eaf71455dbfbaf3112ef5713c51b7f8a5dc8ced21547660e7e155f0ad3430e7c67f8fb7095bf0b7524752699 SHA512 0a28efaa997f8db7631feb1bd426708d230815afba04259397c13fc337be500318586461190ba2039ef4ffb9d68b7c7799af1dd4c88ba612e5b75790b756bd4c
|
||||
DIST libwrc-experimental-20221009.tar.gz 1810133 BLAKE2B 74ba2e4aa3b05839609cc494b0102dc677b672d24d9fede16edc7062d9c0d76d63aad553d0710ca8c22308cc22a43e6c42b842ad44f4d0e8c37698820ae746da SHA512 2a0e119c0ee4f877afb9c82ca393440c28192415397146ac7caf1cdc5564dbb8f623a74f5f28f1137022a0cf7d53c3a77fb7797c9ba35a4c474df048d81c270d
|
||||
DIST libwrc-experimental-20240421.tar.gz 1782506 BLAKE2B 3cee4475e7888a9fdc6a8a8653cb7d842040e6dc2e30e8af026fc4278b648a88e08d917e3f0749fe4c3e8a42e9c41a78863d3c9538a596ce579eb414e2d64379 SHA512 f72d92194b956a0fe3c6800162d5a9f9d9c2d61fa1b4dfeed98eea5e44c92d90fbd7d94f4a7e9e20de6eb5d5a7e8c603ba59d5503768e2c96ce9f6c62ab3a8ca
|
||||
|
|
|
|||
|
|
@ -1,245 +0,0 @@
|
|||
#!/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)
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
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) \
|
||||
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
# see https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0303
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
# Copyright 1999-2019 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
inherit autotools python-single-r1
|
||||
inherit python-single-r1
|
||||
|
||||
DESCRIPTION="Library to access the Windows Resource Compiler (WRC) format"
|
||||
HOMEPAGE="https://github.com/libyal/libwrc"
|
||||
|
|
@ -48,15 +48,6 @@ RDEPEND="
|
|||
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) \
|
||||
|
|
@ -66,8 +57,8 @@ src_configure() {
|
|||
$(use_enable debug verbose-output ) \
|
||||
$(use_enable debug debug-output ) \
|
||||
$(use_enable threads multi-threading-support) \
|
||||
$(use_enable python) \
|
||||
$(use_enable python python3) \
|
||||
$(use_enable python)
|
||||
# $(use_enable python python3) \
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -5,4 +5,7 @@
|
|||
<email>unknown@pentoo.ch</email>
|
||||
<name>Author Unknown</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">libyal/libwrc</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
|
|||
Loading…
Reference in a new issue