pdf-parser-0.7.5.ebuild

This commit is contained in:
Anton Bolshakov 2022-01-08 08:54:59 +08:00
parent d39a243eb4
commit b3e8573662
No known key found for this signature in database
GPG key ID: 32BDCED870788F04
4 changed files with 48 additions and 27 deletions

View file

@ -1 +1,2 @@
DIST pdf-parser_V0_7_4.zip 14999 BLAKE2B 94764426afe8854832102afd4c71100f1f8b3e436ba25b94b07e101d6c7b156921fa49aaca01c34d67e167f7cfadcbfd125ded03a531e011fa71605399988b05 SHA512 9984cd9792818331224e74c450065a815b8081147541ba911d13913fb62202c3e50a752f3e3d8600d763f1f9ca0f2615afb4761c81520da2046400236f20ce40
DIST pdf-parser_V0_7_5.zip 15037 BLAKE2B a1dd62a460cf38c191ffdaf1fef5b538cfe71b1b2460ec1339a2d78f8af1e1bcd9f80610943552c01f545748d309e4708f259b78f678dcd49ae174e2bbab1b54 SHA512 e236fa74fadc7a99bcedb6ec342d47fa1e47b65cead158c2d055b1c4c2c616243497e6c9af7b854ef2ec20f13b468948b6c3bfcd1f183f5f63d77e92ad067964

View file

@ -1,26 +0,0 @@
diff -ur a/pdf-parser.py b/pdf-parser.py
--- a/pdf-parser.py 2019-03-18 11:04:30.022785000 +0300
+++ b/pdf-parser.py 2019-03-18 11:21:14.135237324 +0300
@@ -857,11 +857,11 @@
if options.hash:
streamContent = object.Stream(False, options.overridingfilters)
print(' unfiltered')
- print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent).hexdigest()))
+ print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent.encode('utf-8')).hexdigest()))
print(' %s' % HexAsciiDumpLine(streamContent))
streamContent = object.Stream(True, options.overridingfilters)
print(' filtered')
- print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent).hexdigest()))
+ print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent.encode('utf-8')).hexdigest()))
print(' %s' % HexAsciiDumpLine(streamContent))
streamContent = None
else:
@@ -1516,7 +1516,7 @@
elif options.hash:
print('obj %d %d' % (object.id, object.version))
rawContent = FormatOutput(object.content, True)
- print(' len: %d md5: %s' % (len(rawContent), hashlib.md5(rawContent).hexdigest()))
+ print(' len: %d md5: %s' % (len(rawContent), hashlib.md5(rawContent.encode('utf-8')).hexdigest()))
print('')
elif options.searchstream:
if object.StreamContains(options.searchstream, not options.unfiltered, options.casesensitive, options.regex, options.overridingfilters):

View file

@ -15,7 +15,7 @@ SRC_URI="https://www.didierstevens.com/files/software/${MY_P}.zip"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="unicode yara"
DEPEND="${PYTHON_DEPS}

View file

@ -0,0 +1,46 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{9..10} )
inherit python-r1 unpacker
DESCRIPTION="This tool will parse a PDF document to identify the fundamental elements used"
HOMEPAGE="https://blog.didierstevens.com/programs/pdf-tools/"
MY_P="${PN}_V$(ver_rs 1- '_')"
SRC_URI="https://www.didierstevens.com/files/software/${MY_P}.zip"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="unicode yara"
DEPEND="${PYTHON_DEPS}
$(unpacker_src_uri_depends)"
RDEPEND="${DEPEND}
yara? ( dev-python/yara-python[${PYTHON_USEDEP}] )"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
S="${WORKDIR}"
src_prepare() {
# Enable check maximum version of the python3
sed -e 's/TestPythonVersion(enforceMaximumVersion=True)/# REM/' \
-i pdf-parser.py || die
# Fix encoding errors when reading files
use unicode && eapply "${FILESDIR}/0.7.4_define_encoding_format.patch"
default
}
src_install() {
python_foreach_impl python_newscript pdf-parser.py pdf-parser
}
pkg_postinst() {
einfo "\nSee more: https://blog.didierstevens.com/2008/04/09/quickpost-about-the-physical-and-logical-structure-of-pdf-files/\n"
}