summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-10 22:51:44 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-10 22:51:44 +0000
commitdf2299a168c566fced7ddda2c16b86a8140e9963 (patch)
treee5e2582d66e5ff744e158e4b5b03e85a194bd42c
parent974a9087e8c3df7f64456d06a57ab06fe2b14245 (diff)
automatic import of python-zipstream-new
-rw-r--r--.gitignore1
-rw-r--r--python-zipstream-new.spec591
-rw-r--r--sources1
3 files changed, 593 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..6292114 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/zipstream-new-1.1.8.tar.gz
diff --git a/python-zipstream-new.spec b/python-zipstream-new.spec
new file mode 100644
index 0000000..8675929
--- /dev/null
+++ b/python-zipstream-new.spec
@@ -0,0 +1,591 @@
+%global _empty_manifest_terminate_build 0
+Name: python-zipstream-new
+Version: 1.1.8
+Release: 1
+Summary: Zipfile generator that takes input files as well as streams
+License: GNU General Public License v3 (GPLv3)
+URL: https://github.com/arjan-s/python-zipstream
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e5/f3/1b5228576f215b200c7e922a280a92e4494df33baae6e0280a6f45371f13/zipstream-new-1.1.8.tar.gz
+BuildArch: noarch
+
+
+%description
+
+# python-zipstream
+
+zipstream.py is a zip archive generator based on python 3.3's zipfile.py. It was created to
+generate a zip file generator for streaming (ie web apps). This is beneficial for when you
+want to provide a downloadable archive of a large collection of regular files, which would be infeasible to
+generate the archive prior to downloading or of a very large file that you do not want to store entirely on disk or on memory.
+
+The archive is generated as an iterator of strings, which, when joined, form
+the zip archive. For example, the following code snippet would write a zip
+archive containing files from 'path' to a normal file:
+
+```python
+import zipstream
+
+z = zipstream.ZipFile()
+z.write('path/to/files')
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+zipstream also allows to take as input a byte string iterable and to generate
+the archive as an iterator.
+This avoids storing large files on disk or in memory.
+To do so you could use something like this snippet:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Of course both approach can be combined:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write('path/to/files', 'my_archive_files')
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Since recent versions of web.py support returning iterators of strings to be
+sent to the browser, to download a dynamically generated archive, you could
+use something like this snippet:
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+If the zlib module is available, zipstream.ZipFile can generate compressed zip
+archives.
+
+## Installation
+
+```
+pip install zipstream-new
+```
+
+## Requirements
+
+ * Python 2.6+, 3.2+, pypy
+
+## Examples
+
+### flask
+
+```python
+from flask import Response
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generator():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ z.write('/path/to/file')
+
+ for chunk in z:
+ yield chunk
+
+ response = Response(generator(), mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# or
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# Partial flushing of the zip before closing
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generate_zip_with_manifest():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ manifest = []
+ for filename in os.listdir('/path/to/files'):
+ z.write(os.path.join('/path/to/files', filename), arcname=filename)
+ yield from z.flush()
+ manifest.append(filename)
+
+ z.write_str('manifest.json', json.dumps(manifest).encode())
+
+ yield from z
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### django 1.5+
+
+```python
+from django.http import StreamingHttpResponse
+
+def zipball(request):
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = StreamingHttpResponse(z, content_type='application/zip')
+ response['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### webpy
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+## Running tests
+
+With python version > 2.6, just run the following command: `python -m unittest discover`
+
+Alternatively, you can use `nose`.
+
+If you want to run the tests on all supported Python versions, run `tox`.
+
+
+
+
+%package -n python3-zipstream-new
+Summary: Zipfile generator that takes input files as well as streams
+Provides: python-zipstream-new
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-zipstream-new
+
+# python-zipstream
+
+zipstream.py is a zip archive generator based on python 3.3's zipfile.py. It was created to
+generate a zip file generator for streaming (ie web apps). This is beneficial for when you
+want to provide a downloadable archive of a large collection of regular files, which would be infeasible to
+generate the archive prior to downloading or of a very large file that you do not want to store entirely on disk or on memory.
+
+The archive is generated as an iterator of strings, which, when joined, form
+the zip archive. For example, the following code snippet would write a zip
+archive containing files from 'path' to a normal file:
+
+```python
+import zipstream
+
+z = zipstream.ZipFile()
+z.write('path/to/files')
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+zipstream also allows to take as input a byte string iterable and to generate
+the archive as an iterator.
+This avoids storing large files on disk or in memory.
+To do so you could use something like this snippet:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Of course both approach can be combined:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write('path/to/files', 'my_archive_files')
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Since recent versions of web.py support returning iterators of strings to be
+sent to the browser, to download a dynamically generated archive, you could
+use something like this snippet:
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+If the zlib module is available, zipstream.ZipFile can generate compressed zip
+archives.
+
+## Installation
+
+```
+pip install zipstream-new
+```
+
+## Requirements
+
+ * Python 2.6+, 3.2+, pypy
+
+## Examples
+
+### flask
+
+```python
+from flask import Response
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generator():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ z.write('/path/to/file')
+
+ for chunk in z:
+ yield chunk
+
+ response = Response(generator(), mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# or
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# Partial flushing of the zip before closing
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generate_zip_with_manifest():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ manifest = []
+ for filename in os.listdir('/path/to/files'):
+ z.write(os.path.join('/path/to/files', filename), arcname=filename)
+ yield from z.flush()
+ manifest.append(filename)
+
+ z.write_str('manifest.json', json.dumps(manifest).encode())
+
+ yield from z
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### django 1.5+
+
+```python
+from django.http import StreamingHttpResponse
+
+def zipball(request):
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = StreamingHttpResponse(z, content_type='application/zip')
+ response['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### webpy
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+## Running tests
+
+With python version > 2.6, just run the following command: `python -m unittest discover`
+
+Alternatively, you can use `nose`.
+
+If you want to run the tests on all supported Python versions, run `tox`.
+
+
+
+
+%package help
+Summary: Development documents and examples for zipstream-new
+Provides: python3-zipstream-new-doc
+%description help
+
+# python-zipstream
+
+zipstream.py is a zip archive generator based on python 3.3's zipfile.py. It was created to
+generate a zip file generator for streaming (ie web apps). This is beneficial for when you
+want to provide a downloadable archive of a large collection of regular files, which would be infeasible to
+generate the archive prior to downloading or of a very large file that you do not want to store entirely on disk or on memory.
+
+The archive is generated as an iterator of strings, which, when joined, form
+the zip archive. For example, the following code snippet would write a zip
+archive containing files from 'path' to a normal file:
+
+```python
+import zipstream
+
+z = zipstream.ZipFile()
+z.write('path/to/files')
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+zipstream also allows to take as input a byte string iterable and to generate
+the archive as an iterator.
+This avoids storing large files on disk or in memory.
+To do so you could use something like this snippet:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Of course both approach can be combined:
+
+```python
+def iterable():
+ for _ in xrange(10):
+ yield b'this is a byte string\x01\n'
+
+z = zipstream.ZipFile()
+z.write('path/to/files', 'my_archive_files')
+z.write_iter('my_archive_iter', iterable())
+
+with open('zipfile.zip', 'wb') as f:
+ for data in z:
+ f.write(data)
+```
+
+Since recent versions of web.py support returning iterators of strings to be
+sent to the browser, to download a dynamically generated archive, you could
+use something like this snippet:
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+If the zlib module is available, zipstream.ZipFile can generate compressed zip
+archives.
+
+## Installation
+
+```
+pip install zipstream-new
+```
+
+## Requirements
+
+ * Python 2.6+, 3.2+, pypy
+
+## Examples
+
+### flask
+
+```python
+from flask import Response
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generator():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ z.write('/path/to/file')
+
+ for chunk in z:
+ yield chunk
+
+ response = Response(generator(), mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# or
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+
+# Partial flushing of the zip before closing
+
+@app.route('/package.zip', methods=['GET'], endpoint='zipball')
+def zipball():
+ def generate_zip_with_manifest():
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+
+ manifest = []
+ for filename in os.listdir('/path/to/files'):
+ z.write(os.path.join('/path/to/files', filename), arcname=filename)
+ yield from z.flush()
+ manifest.append(filename)
+
+ z.write_str('manifest.json', json.dumps(manifest).encode())
+
+ yield from z
+
+ response = Response(z, mimetype='application/zip')
+ response.headers['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### django 1.5+
+
+```python
+from django.http import StreamingHttpResponse
+
+def zipball(request):
+ z = zipstream.ZipFile(mode='w', compression=zipstream.ZIP_DEFLATED)
+ z.write('/path/to/file')
+
+ response = StreamingHttpResponse(z, content_type='application/zip')
+ response['Content-Disposition'] = 'attachment; filename={}'.format('files.zip')
+ return response
+```
+
+### webpy
+
+```python
+def GET(self):
+ path = '/path/to/dir/of/files'
+ zip_filename = 'files.zip'
+ web.header('Content-type' , 'application/zip')
+ web.header('Content-Disposition', 'attachment; filename="%s"' % (
+ zip_filename,))
+ return zipstream.ZipFile(path)
+```
+
+## Running tests
+
+With python version > 2.6, just run the following command: `python -m unittest discover`
+
+Alternatively, you can use `nose`.
+
+If you want to run the tests on all supported Python versions, run `tox`.
+
+
+
+
+%prep
+%autosetup -n zipstream-new-1.1.8
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-zipstream-new -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.8-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..f59106a
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+acd41cc94496e08bd8e86a83b214d9e0 zipstream-new-1.1.8.tar.gz