diff --git a/python-pypdf/PKGBUILD b/python-pypdf/PKGBUILD deleted file mode 100644 index e1c251b5e..000000000 --- a/python-pypdf/PKGBUILD +++ /dev/null @@ -1,32 +0,0 @@ -# -# Chakra Packages for Chakra, part of chakra-project.org -# -# contributor (x86_64): Giuseppe Calà - -# include global config -source ../_buildscripts/${current_repo}-${_arch}-cfg.conf - -pkgname=python-pypdf -pkgver=1.12 -pkgrel=2 -pkgdesc="A Pure-Python library built as a PDF toolkit" -arch=('any') -url="http://pybrary.net/pyPdf" -license=('BSD') -depends=('python2') - -source=(http://pybrary.net/pyPdf/pyPdf-$pkgver.tar.gz - license.txt - pypdf_hashlib_frozenset_unicode.patch) - -md5sums=('7be5f7f4659f64fd194e9eb9a38ad425' - '19b1b4bc0a9a8c4b7b2f5689a16cec2c' - '08361260188b3719d52f3e8bb00ff86f') - -build() { - cd ${srcdir}/pyPdf-${pkgver} - - patch -p1 < ${srcdir}/pypdf_hashlib_frozenset_unicode.patch - python2 setup.py install --root=${pkgdir} - install -D -m644 ../license.txt ${pkgdir}/usr/share/licenses/${pkgname}/license.txt -} diff --git a/python-pypdf/pypdf_hashlib_frozenset_unicode.patch b/python-pypdf/pypdf_hashlib_frozenset_unicode.patch deleted file mode 100644 index f7371b8e3..000000000 --- a/python-pypdf/pypdf_hashlib_frozenset_unicode.patch +++ /dev/null @@ -1,174 +0,0 @@ -diff -Naur pyPdf-1.12/pyPdf/generic.py src/pyPdf-1.12/pyPdf/generic.py ---- pyPdf-1.12/pyPdf/generic.py 2009-08-03 19:11:12.000000000 +0200 -+++ pyPdf-1.12/pyPdf/generic.py 2009-08-03 20:40:22.000000000 +0200 -@@ -212,8 +212,6 @@ - - - class NumberObject(int, PdfObject): -- def __init__(self, value): -- int.__init__(self, value) - - def writeToStream(self, stream, encryption_key): - stream.write(repr(self)) -@@ -402,9 +400,6 @@ - class NameObject(str, PdfObject): - delimiterCharacters = "(", ")", "<", ">", "[", "]", "{", "}", "/", "%" - -- def __init__(self, data): -- str.__init__(self, data) -- - def writeToStream(self, stream, encryption_key): - stream.write(self) - -diff -Naur pyPdf-1.12/pyPdf/pdf.py src/pyPdf-1.12/pyPdf/pdf.py ---- pyPdf-1.12/pyPdf/pdf.py 2008-09-02 23:19:48.000000000 +0200 -+++ pyPdf-1.12/pyPdf/pdf.py.fixed 2009-11-11 13:28:03.000000000 +0100 -@@ -49,7 +49,6 @@ - import warnings - from generic import * - from utils import readNonWhitespace, readUntilWhitespace, ConvertFunctionsToVirtualList --from sets import ImmutableSet - - ## - # This class supports writing PDF files out, given pages produced by another -@@ -119,7 +118,7 @@ - # encryption. When false, 40bit encryption will be used. By default, this - # flag is on. - def encrypt(self, user_pwd, owner_pwd = None, use_128bit = True): -- import md5, time, random -+ import hashlib, time, random - if owner_pwd == None: - owner_pwd = user_pwd - if use_128bit: -@@ -133,8 +132,8 @@ - # permit everything: - P = -1 - O = ByteStringObject(_alg33(owner_pwd, user_pwd, rev, keylen)) -- ID_1 = md5.new(repr(time.time())).digest() -- ID_2 = md5.new(repr(random.random())).digest() -+ ID_1 = hashlib.md5(repr(time.time())).digest() -+ ID_2 = hashlib.md5(repr(random.random())).digest() - self._ID = ArrayObject((ByteStringObject(ID_1), ByteStringObject(ID_2))) - if rev == 2: - U, key = _alg34(user_pwd, O, P, ID_1) -@@ -160,7 +159,7 @@ - # @param stream An object to write the file to. The object must support - # the write method, and the tell method, similar to a file object. - def write(self, stream): -- import struct, md5 -+ import struct, hashlib - - externalReferenceMap = {} - self.stack = [] -@@ -181,7 +180,7 @@ - pack2 = struct.pack("= 3 and not metadata_encrypt: -@@ -1394,7 +1399,7 @@ - # /Length entry. - if rev >= 3: - for i in range(50): -- md5_hash = md5.new(md5_hash[:keylen]).digest() -+ md5_hash = hashlib.md5(md5_hash[:keylen]).digest() - # 9. Set the encryption key to the first n bytes of the output from the - # final MD5 hash, where n is always 5 for revision 2 but, for revision 3 or - # greater, depends on the value of the encryption dictionary's /Length -@@ -1436,14 +1441,14 @@ - password = (password + _encryption_padding)[:32] - # 2. Initialize the MD5 hash function and pass the result of step 1 as - # input to this function. -- import md5 -- m = md5.new(password) -+ import hashlib -+ m = hashlib.md5(password) - # 3. (Revision 3 or greater) Do the following 50 times: Take the output - # from the previous MD5 hash and pass it as input into a new MD5 hash. - md5_hash = m.digest() - if rev >= 3: - for i in range(50): -- md5_hash = md5.new(md5_hash).digest() -+ md5_hash = hashlib.md5(md5_hash).digest() - # 4. Create an RC4 encryption key using the first n bytes of the output - # from the final MD5 hash, where n is always 5 for revision 2 but, for - # revision 3 or greater, depends on the value of the encryption -@@ -1473,14 +1478,17 @@ - key = _alg32(password, rev, keylen, owner_entry, p_entry, id1_entry) - # 2. Initialize the MD5 hash function and pass the 32-byte padding string - # shown in step 1 of Algorithm 3.2 as input to this function. -- import md5 -- m = md5.new() -+ import hashlib -+ m = hashlib.md5() - m.update(_encryption_padding) - # 3. Pass the first element of the file's file identifier array (the value - # of the ID entry in the document's trailer dictionary; see Table 3.13 on - # page 73) to the hash function and finish the hash. (See implementation - # note 25 in Appendix H.) -- m.update(id1_entry) -+ if isinstance(id1_entry, str): -+ m.update(id1_entry) -+ else: -+ m.update(id1_entry.original_bytes) - md5_hash = m.digest() - # 4. Encrypt the 16-byte result of the hash, using an RC4 encryption - # function with the encryption key from step 1. diff --git a/python2-pdf/PKGBUILD b/python2-pdf/PKGBUILD new file mode 100644 index 000000000..046b6cf0b --- /dev/null +++ b/python2-pdf/PKGBUILD @@ -0,0 +1,27 @@ +# +# Apps Packages for Chakra, part of chakra-project.org +# +# Maintainer: Adrian Chaves Fernandez (Gallaecio) +# Contributor: Giuseppe Calà + +pkgname=python2-pdf +_pkgname=pyPdf +pkgver=1.13 +pkgrel=1 +pkgdesc="A Pure-Python library built as a PDF toolkit" +arch=('any') +url="http://pybrary.net/pyPdf" +license=('BSD') +depends=('python2') +replaces=(python-pypdf) +provides=(python-pypdf) +source=(http://pybrary.net/$_pkgname/$_pkgname-$pkgver.tar.gz + license.txt) +md5sums=('7a75ef56f227b78ae62d6e38d4b6b1da' + '19b1b4bc0a9a8c4b7b2f5689a16cec2c') + +package() { + cd ${srcdir}/$_pkgname-${pkgver} + python2 setup.py install --root=${pkgdir} + install -D -m644 ../license.txt ${pkgdir}/usr/share/licenses/${pkgname}/license.txt +} diff --git a/python-pypdf/license.txt b/python2-pdf/license.txt similarity index 100% rename from python-pypdf/license.txt rename to python2-pdf/license.txt