mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
Remove unused rarfile1 import
This commit is contained in:
parent
30a1789809
commit
4f3738fab5
48 changed files with 0 additions and 2063 deletions
|
@ -1,15 +0,0 @@
|
|||
|
||||
Copyright (c) 2005-2016 Marko Kreen <markokr@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
include README.rst Makefile MANIFEST.in LICENSE dumprar.py
|
||||
include doc/*.rst doc/Makefile doc/conf.py doc/make.bat
|
||||
include test/Makefile test/*.sh test/files/*.rar test/files/*.exp
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
prefix = /usr/local
|
||||
|
||||
all:
|
||||
python setup.py build
|
||||
|
||||
install:
|
||||
python setup.py install --prefix=$(prefix)
|
||||
|
||||
tgz: clean
|
||||
python setup.py sdist
|
||||
|
||||
clean:
|
||||
rm -rf __pycache__ build dist
|
||||
rm -f *.pyc MANIFEST *.orig *.rej *.html *.class
|
||||
rm -rf doc/_build doc/_static doc/_templates
|
||||
make -C test clean
|
||||
|
||||
html:
|
||||
rst2html README.rst > README.html
|
||||
make -C doc html
|
||||
|
||||
lint:
|
||||
pylint -E rarfile.py
|
||||
|
||||
rbuild:
|
||||
curl -X POST https://readthedocs.org/build/6715
|
||||
|
||||
upload:
|
||||
python setup.py sdist upload
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: rarfile
|
||||
Version: 2.8
|
||||
Summary: RAR archive reader for Python
|
||||
Home-page: https://github.com/markokr/rarfile
|
||||
Author: Marko Kreen
|
||||
Author-email: markokr@gmail.com
|
||||
License: ISC
|
||||
Description: rarfile - RAR archive reader for Python
|
||||
=======================================
|
||||
|
||||
This is Python module for RAR_ archive reading. The interface
|
||||
is made as zipfile_ like as possible. Licensed under ISC_
|
||||
license.
|
||||
|
||||
Features:
|
||||
|
||||
- Supports both RAR2 and RAR3 archives (WinRAR 2.x .. WinRAR 4.x).
|
||||
- Supports multi volume archives.
|
||||
- Supports Unicode filenames.
|
||||
- Supports password-protected archives.
|
||||
- Supports archive and file comments.
|
||||
- Archive parsing and non-compressed files are handled in pure Python code.
|
||||
- Compressed files are extracted by executing external tool: either ``unrar``
|
||||
from RARLAB_ or ``bsdtar`` from libarchive_.
|
||||
- Works with both Python 2.7 and 3.x.
|
||||
|
||||
Notes:
|
||||
|
||||
- Does not support the RAR5 format introduced in WinRAR 5.0.
|
||||
- ``bsdtar`` does not support all RAR3 features.
|
||||
|
||||
Links:
|
||||
|
||||
- `Documentation`_
|
||||
- `Downloads`_
|
||||
- `Git`_ repo
|
||||
|
||||
.. _RAR: https://en.wikipedia.org/wiki/RAR_%28file_format%29
|
||||
.. _zipfile: https://docs.python.org/2/library/zipfile.html
|
||||
.. _ISC: https://en.wikipedia.org/wiki/ISC_license
|
||||
.. _Git: https://github.com/markokr/rarfile
|
||||
.. _Downloads: https://pypi.python.org/pypi/rarfile
|
||||
.. _Documentation: https://rarfile.readthedocs.io/
|
||||
.. _libarchive: https://github.com/libarchive/libarchive
|
||||
.. _RARLAB: http://www.rarlab.com/
|
||||
Keywords: rar,unrar,archive
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: ISC License (ISCL)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: System :: Archiving :: Compression
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
rarfile - RAR archive reader for Python
|
||||
=======================================
|
||||
|
||||
This is Python module for RAR_ archive reading. The interface
|
||||
is made as zipfile_ like as possible. Licensed under ISC_
|
||||
license.
|
||||
|
||||
Features:
|
||||
|
||||
- Supports both RAR2 and RAR3 archives (WinRAR 2.x .. WinRAR 4.x).
|
||||
- Supports multi volume archives.
|
||||
- Supports Unicode filenames.
|
||||
- Supports password-protected archives.
|
||||
- Supports archive and file comments.
|
||||
- Archive parsing and non-compressed files are handled in pure Python code.
|
||||
- Compressed files are extracted by executing external tool: either ``unrar``
|
||||
from RARLAB_ or ``bsdtar`` from libarchive_.
|
||||
- Works with both Python 2.7 and 3.x.
|
||||
|
||||
Notes:
|
||||
|
||||
- Does not support the RAR5 format introduced in WinRAR 5.0.
|
||||
- ``bsdtar`` does not support all RAR3 features.
|
||||
|
||||
Links:
|
||||
|
||||
- `Documentation`_
|
||||
- `Downloads`_
|
||||
- `Git`_ repo
|
||||
|
||||
.. _RAR: https://en.wikipedia.org/wiki/RAR_%28file_format%29
|
||||
.. _zipfile: https://docs.python.org/2/library/zipfile.html
|
||||
.. _ISC: https://en.wikipedia.org/wiki/ISC_license
|
||||
.. _Git: https://github.com/markokr/rarfile
|
||||
.. _Downloads: https://pypi.python.org/pypi/rarfile
|
||||
.. _Documentation: https://rarfile.readthedocs.io/
|
||||
.. _libarchive: https://github.com/libarchive/libarchive
|
||||
.. _RARLAB: http://www.rarlab.com/
|
|
@ -1,153 +0,0 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/RarFile.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/RarFile.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/RarFile"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/RarFile"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
|
@ -1,111 +0,0 @@
|
|||
|
||||
rarfile API documentation
|
||||
=========================
|
||||
|
||||
.. contents:: Table Of Contents
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
.. automodule:: rarfile
|
||||
|
||||
RarFile class
|
||||
-------------
|
||||
|
||||
.. autoclass:: RarFile
|
||||
:members:
|
||||
:inherited-members:
|
||||
|
||||
RarInfo class
|
||||
-------------
|
||||
|
||||
.. autoclass:: RarInfo
|
||||
:members:
|
||||
:inherited-members:
|
||||
|
||||
RarExtFile class
|
||||
----------------
|
||||
|
||||
.. autoclass:: RarExtFile
|
||||
:members:
|
||||
:inherited-members:
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
.. autofunction:: is_rarfile
|
||||
|
||||
Module Configuration
|
||||
--------------------
|
||||
|
||||
.. autodata:: UNRAR_TOOL
|
||||
.. autodata:: DEFAULT_CHARSET
|
||||
.. autodata:: TRY_ENCODINGS
|
||||
.. autodata:: USE_DATETIME
|
||||
.. autodata:: PATH_SEP
|
||||
.. autodata:: NEED_COMMENTS
|
||||
.. autodata:: UNICODE_COMMENTS
|
||||
.. autodata:: USE_EXTRACT_HACK
|
||||
.. autodata:: HACK_SIZE_LIMIT
|
||||
|
||||
Constants
|
||||
---------
|
||||
|
||||
.. py:data:: RAR_M0
|
||||
|
||||
No compression.
|
||||
|
||||
.. py:data:: RAR_M1
|
||||
|
||||
Compression level `-m1` - Fastest compression.
|
||||
|
||||
.. py:data:: RAR_M2
|
||||
|
||||
Compression level `-m2`.
|
||||
|
||||
.. py:data:: RAR_M3
|
||||
|
||||
Compression level `-m3`.
|
||||
|
||||
.. py:data:: RAR_M4
|
||||
|
||||
Compression level `-m4`.
|
||||
|
||||
.. py:data:: RAR_M5
|
||||
|
||||
Compression level `-m5` - Maximum compression.
|
||||
|
||||
.. py:data:: RAR_OS_MSDOS
|
||||
.. py:data:: RAR_OS_OS2
|
||||
.. py:data:: RAR_OS_WIN32
|
||||
.. py:data:: RAR_OS_UNIX
|
||||
.. py:data:: RAR_OS_MACOS
|
||||
.. py:data:: RAR_OS_BEOS
|
||||
|
||||
Exceptions
|
||||
----------
|
||||
|
||||
.. autoclass:: Error
|
||||
.. autoclass:: BadRarFile
|
||||
.. autoclass:: NotRarFile
|
||||
.. autoclass:: BadRarName
|
||||
.. autoclass:: NoRarEntry
|
||||
.. autoclass:: PasswordRequired
|
||||
.. autoclass:: NeedFirstVolume
|
||||
.. autoclass:: NoCrypto
|
||||
.. autoclass:: RarExecError
|
||||
.. autoclass:: RarWarning
|
||||
.. autoclass:: RarFatalError
|
||||
.. autoclass:: RarCRCError
|
||||
.. autoclass:: RarLockedArchiveError
|
||||
.. autoclass:: RarWriteError
|
||||
.. autoclass:: RarOpenError
|
||||
.. autoclass:: RarUserError
|
||||
.. autoclass:: RarMemoryError
|
||||
.. autoclass:: RarCreateError
|
||||
.. autoclass:: RarNoFilesError
|
||||
.. autoclass:: RarUserBreak
|
||||
.. autoclass:: RarUnknownError
|
||||
.. autoclass:: RarSignalExit
|
||||
|
||||
|
|
@ -1,249 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# RarFile documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Mar 24 13:29:46 2013.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os, os.path
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
import rarfile
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
|
||||
|
||||
autodoc_member_order = 'bysource'
|
||||
autoclass_content = 'both'
|
||||
autodoc_default_flags = ['show-inheritance']
|
||||
|
||||
intersphinx_mapping = {'python': ('http://docs.python.org/2', None)}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'RarFile'
|
||||
copyright = u'2005-2016, Marko Kreen'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = rarfile.__version__
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = rarfile.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
#html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
html_show_sphinx = False
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
#htmlhelp_basename = 'RarFiledoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'RarFile.tex', u'RarFile Documentation',
|
||||
u'Marko Kreen', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
#man_pages = [
|
||||
# ('index', 'rarfile', u'RarFile Documentation',
|
||||
# [u'Marko Kreen'], 1)
|
||||
#]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'RarFile', u'RarFile Documentation',
|
||||
u'Marko Kreen', 'RarFile', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
|
@ -1,87 +0,0 @@
|
|||
|
||||
rarfile FAQ
|
||||
===========
|
||||
|
||||
.. contents:: Table of Contents
|
||||
|
||||
What are the dependencies?
|
||||
--------------------------
|
||||
|
||||
It depends on ``unrar`` command-line utility to do the actual decompression.
|
||||
Note that by default it expect it to be in ``PATH``. If unrar
|
||||
launching fails, you need to fix this.
|
||||
|
||||
Alternatively, :mod:`rarfile` can use bsdtar_ from libarchive_ as
|
||||
decompression backend, but that is a bit problematic as bsdtar_ does not support
|
||||
all RAR features.
|
||||
|
||||
.. _bsdtar: https://github.com/libarchive/libarchive/wiki/ManPageBsdtar1
|
||||
.. _libarchive: http://www.libarchive.org/
|
||||
|
||||
It depends on cryptography_ or PyCrypto_ modules to process
|
||||
archives with password-protected headers.
|
||||
|
||||
.. _cryptography: https://pypi.python.org/pypi/cryptography
|
||||
.. _PyCrypto: https://pypi.python.org/pypi/pycrypto
|
||||
|
||||
Does it parse ``unrar`` output to get archive contents?
|
||||
-------------------------------------------------------
|
||||
|
||||
No, :mod:`rarfile` parses RAR structure in Python code. Also it can
|
||||
read uncompressed files from archive without external utility.
|
||||
|
||||
Will rarfile support wrapping unrarlib/unrar.dll/unrar.so in the future?
|
||||
------------------------------------------------------------------------
|
||||
|
||||
No. The current architecture - parsing in Python and decompression with
|
||||
command line tools work well across all interesting operating systems
|
||||
(Windows/Linux/MacOS), wrapping a library does not bring any advantages.
|
||||
|
||||
Simple execution of command-line tools is also legally simpler situation
|
||||
than linking with external library.
|
||||
|
||||
How can I get it work on Windows?
|
||||
---------------------------------
|
||||
|
||||
On Windows the ``unrar.exe`` is not in ``PATH`` so simple ``Popen("unrar ..")`` does not work.
|
||||
It can be solved several ways:
|
||||
|
||||
1. Add location of ``unrar.exe`` to PATH.
|
||||
2. Set :data:`rarfile.UNRAR_TOOL` to full path of ``unrar.exe``.
|
||||
3. Copy ``unrar.exe`` to your program directory.
|
||||
4. Copy ``unrar.exe`` to system directory that is in PATH, eg. ``C:\Windows``.
|
||||
|
||||
How to avoid the need for user to manually install rarfile/unrar?
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Include ``rarfile.py`` and/or ``unrar`` with your application.
|
||||
|
||||
Will it support creating RAR archives?
|
||||
--------------------------------------
|
||||
|
||||
No. RARLAB_ is not interested in RAR becoming open format
|
||||
and specifically discourages writing RAR creation software.
|
||||
|
||||
In the meantime use either Zip_ (better compatibility) or 7z_ (better compression)
|
||||
format for your own archives.
|
||||
|
||||
.. _RARLAB: http://www.rarlab.com/
|
||||
.. _Zip: https://en.wikipedia.org/wiki/ZIP_%28file_format%29
|
||||
.. _7z: https://en.wikipedia.org/wiki/7z
|
||||
|
||||
What is the USE_EXTRACT_HACK?
|
||||
-----------------------------
|
||||
|
||||
RarFile uses ``unrar`` to extract compressed files. But when extracting
|
||||
single file from archive containing many entries, ``unrar`` needs to parse
|
||||
whole archive until it finds the right entry. This makes random-access
|
||||
to entries slow. To avoid that, RarFile remembers location of compressed
|
||||
data for each entry and on read it copies it to temporary archive containing
|
||||
only data for that one file, thus making ``unrar`` fast.
|
||||
|
||||
The logic is only activated for entries smaller than :data:`rarfile.HACK_SIZE_LIMIT`
|
||||
(20M by default). Bigger files are accessed directly from RAR.
|
||||
|
||||
Note - it only works for non-solid archives. So if you care about
|
||||
random access to files in your archive, do not create solid archives.
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
|
||||
rarfile - RAR archive reader for Python
|
||||
=======================================
|
||||
|
||||
This is Python module for RAR_ archive reading. The interface
|
||||
is made as zipfile_ like as possible. Licensed under ISC_
|
||||
license.
|
||||
|
||||
.. _RAR: http://en.wikipedia.org/wiki/RAR
|
||||
.. _zipfile: http://docs.python.org/library/zipfile.html
|
||||
.. _ISC: http://en.wikipedia.org/wiki/ISC_license
|
||||
|
||||
Features:
|
||||
|
||||
- Supports both RAR 2.x and 3.x archives.
|
||||
- Supports multi volume archives.
|
||||
- Supports Unicode filenames.
|
||||
- Supports password-protected archives.
|
||||
- Supports archive and file comments.
|
||||
- Archive parsing and non-compressed files are handled in pure Python code.
|
||||
- For compressed files runs ``unrar`` utility.
|
||||
- Works with both Python 2.x and 3.x.
|
||||
|
||||
|
||||
|
||||
Documentation:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
Module Documentation <api>
|
||||
FAQs <faq>
|
||||
Release News <news>
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\RarFile.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\RarFile.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
|
@ -1,243 +0,0 @@
|
|||
|
||||
rarfile history
|
||||
===============
|
||||
|
||||
.. py:currentmodule:: rarfile
|
||||
|
||||
Version 2.8 (2016-06-07)
|
||||
------------------------
|
||||
|
||||
* Fix: support solid archives from in-memory file object.
|
||||
Full archive will be written out to temp file.
|
||||
[`#21 <https://github.com/markokr/rarfile/issues/21>`_]
|
||||
|
||||
* Fix: ask unrar stop switches scanning,
|
||||
to handle archive names starting with "-".
|
||||
(Alexander Shadchin)
|
||||
[`#12 <https://github.com/markokr/rarfile/pull/12>`_]
|
||||
|
||||
* Fix: add missing _parse_error variable to RarFile object.
|
||||
(Gregory Mazzola)
|
||||
[`#20 <https://github.com/markokr/rarfile/pull/20>`_]
|
||||
|
||||
* Fix: return proper boolean from :meth:`RarInfo.needs_password`.
|
||||
[`#22 <https://github.com/markokr/rarfile/issues/22>`_]
|
||||
|
||||
* Fix: do not insert non-string rarfile into exception string.
|
||||
(Tim Muller)
|
||||
[`#23 <https://github.com/markokr/rarfile/pull/23>`_]
|
||||
|
||||
* Fix: make :meth:`RarFile.extract` and :meth:`RarFile.testrar`
|
||||
support in-memory archives.
|
||||
|
||||
* Use cryptography_ module as preferred crypto backend.
|
||||
PyCrypto_ will be used as fallback.
|
||||
|
||||
* Cleanup: remove compat code for Python 2.4/2.5/2.6.
|
||||
|
||||
.. _cryptography: https://pypi.python.org/pypi/cryptography
|
||||
.. _PyCrypto: https://pypi.python.org/pypi/pycrypto
|
||||
|
||||
Version 2.7 (2014-11-23)
|
||||
------------------------
|
||||
|
||||
* Allow use of bsdtar_ as decompression backend. It sits
|
||||
on top of libarchive_, which has support for reading RAR archives.
|
||||
|
||||
Limitations of ``libarchive`` RAR backend:
|
||||
|
||||
- Does not support solid archives.
|
||||
- Does not support password-protected archives.
|
||||
- Does not support "parsing filters" used for audio/image/executable data,
|
||||
so few non-solid, non-encrypted archives also fail.
|
||||
|
||||
Now :mod:`rarfile` checks if ``unrar`` and if not then tries ``bsdtar``.
|
||||
If that works, then keeps using it. If not then configuration
|
||||
stays with ``unrar`` which will then appear in error messages.
|
||||
|
||||
.. _bsdtar: https://github.com/libarchive/libarchive/wiki/ManPageBsdtar1
|
||||
.. _libarchive: http://www.libarchive.org/
|
||||
|
||||
* Both :class:`RarFile` and :func:`is_rarfile` now accept file-like
|
||||
object. Eg. :class:`io.BytesIO`. Only requirement is that the object
|
||||
must be seekable. This mirrors similar funtionality in zipfile.
|
||||
|
||||
Based on patch by Chase Zhang.
|
||||
|
||||
* Uniform error handling. :class:`RarFile` accepts ``errors="strict"``
|
||||
argument.
|
||||
|
||||
Allow user to tune whether parsing and missing file errors will raise
|
||||
exception. If error is not raised, the error string can be queried
|
||||
with :meth:`RarFile.strerror` method.
|
||||
|
||||
Version 2.6 (2013-04-10)
|
||||
------------------------
|
||||
|
||||
* Add context manager support for :class:`RarFile` class.
|
||||
Both :class:`RarFile` and :class:`RarExtFile` support
|
||||
:keyword:`with` statement now.
|
||||
(Wentao Han)
|
||||
* :meth:`RarFile.volumelist` method, returns filenames of archive volumes.
|
||||
* Re-throw clearer error in case ``unrar`` is not found in ``PATH``.
|
||||
* Sync new unrar4.x error code from ``rar.txt``.
|
||||
* Use Sphinx for documentation, push docs to rtfd.org_
|
||||
|
||||
.. _rtfd.org: https://rarfile.readthedocs.org/
|
||||
|
||||
Version 2.5 (2012-01-19)
|
||||
------------------------
|
||||
|
||||
Fixes:
|
||||
|
||||
* :meth:`RarExtFile.read` and :meth:`RarExtFile.readinto` now do looping read
|
||||
to work properly on short reads. Important for Python 3.2+ where read from pipe
|
||||
can return short result even on blocking file descriptor.
|
||||
* Proper error reporting in :meth:`RarFile.extract`, :meth:`RarFile.extractall`
|
||||
and :meth:`RarFile.testrar`.
|
||||
* :meth:`RarExtFile.read` from unrar pipe: prefer to return unrar error code,
|
||||
if thats not available, do own error checks.
|
||||
* Avoid string addition in :meth:`RarExtFile.read`, instead use always list+join to
|
||||
merge multi-part reads.
|
||||
* dumprar: dont re-encode byte strings (Python 2.x). This avoids
|
||||
unneccessary failure when printing invalid unicode.
|
||||
|
||||
Version 2.4 (2011-11-05)
|
||||
------------------------
|
||||
|
||||
Fixes:
|
||||
|
||||
* :data:`USE_DATETIME`: survive bad values from RAR
|
||||
* Fix bug in corrupt unicode filename handling
|
||||
* dumprar: make unicode chars work with both pipe and console
|
||||
|
||||
Version 2.3 (2011-07-03)
|
||||
------------------------
|
||||
|
||||
Features:
|
||||
|
||||
* Support .seek() method on file streams. (Kristian Larsson)
|
||||
* Support .readinto() method on file streams. Optimized implementation
|
||||
is available on Python 2.6+ where :class:`memoryview` is available.
|
||||
* Support file comments - :attr:`RarInfo.comment` contains decompressed data if available.
|
||||
* File objects returned by :meth:`RarFile.open()` are :class:`io.RawIOBase`-compatible.
|
||||
They can further wrapped with :class:`io.BufferedReader` and :class:`io.TextIOWrapper`.
|
||||
* Now .getinfo() uses dict lookup instead of sequential scan when
|
||||
searching archive entry. This speeds up prococessing for archives that
|
||||
have many entries.
|
||||
* Option :data:`UNICODE_COMMENTS` to decode both archive and file comments to unicode.
|
||||
It uses :data:`TRY_ENCODINGS` for list of encodings to try. If off, comments are
|
||||
left as byte strings. Default: 0
|
||||
* Option :data:`PATH_SEP` to change path separator. Default: ``r'\'``,
|
||||
set ``rarfile.PATH_SEP='/'`` to be compatibe with zipfile.
|
||||
* Option :data:`USE_DATETIME` to convert timestamps to datetime objects.
|
||||
Default: 0, timestamps are tuples.
|
||||
* Option :data:`TRY_ENCODINGS` to allow tuning attempted encoding list.
|
||||
* Reorder :class:`RarInfo` fiels to better show zipfile-compatible fields.
|
||||
* Standard regtests to make sure various features work
|
||||
|
||||
Compatibility:
|
||||
|
||||
* Drop :attr:`RarInfo.unicode_filename`, plain :attr:`RarInfo.filename` is already unicode since 2.0.
|
||||
* .read(-1) reads now until EOF. Previously it returned empty buffer.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Make encrypted headers work with Python 3.x bytes() and with old 2.x 'sha' module.
|
||||
* Simplify :class:`subprocess.Popen` usage when launching ``unrar``. Previously
|
||||
it tried to optimize and work around OS/Python bugs, but this is not
|
||||
maintainable.
|
||||
* Use temp rar file hack on multi-volume archives too.
|
||||
* Always .wait() on unrar, to avoid zombies
|
||||
* Convert struct.error to BadRarFile
|
||||
* Plug some fd leaks. Affected: Jython, PyPy.
|
||||
* Broken archives are handled more robustly.
|
||||
|
||||
Version 2.2 (2010-08-19)
|
||||
------------------------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Relaxed volume naming. Now it just calculates new volume name by finding number
|
||||
in old one and increasing it, without any expectations what that number should be.
|
||||
* Files with 4G of compressed data in one colume were handled wrong. Fix.
|
||||
* DOS timestamp seconds need to be multiplied with 2.
|
||||
* Correct EXTTIME parsing.
|
||||
|
||||
Cleanups:
|
||||
|
||||
* Compressed size is per-volume, sum them together, so that user sees complete
|
||||
compressed size for files split over several volumes.
|
||||
* dumprar: Show unknown bits.
|
||||
* Use :class:`struct.Struct` to cache unpack formats.
|
||||
* Support missing :data:`os.devnull`. (Python 2.3)
|
||||
|
||||
Version 2.1 (2010-07-31)
|
||||
------------------------
|
||||
|
||||
Features:
|
||||
|
||||
* Minimal implmentation for :meth:`RarFile.extract`, :meth:`RarFile.extractall`, :meth:`RarFile.testrar`.
|
||||
They are simple shortcuts to ``unrar`` invocation.
|
||||
* Accept :class:`RarInfo` object where filename is expected.
|
||||
* Include ``dumprar.py`` in .tgz. It can be used to visualize RAR structure
|
||||
and test module.
|
||||
* Support for encrypted file headers.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Don't read past ENDARC, there could be non-RAR data there.
|
||||
* RAR 2.x: It does not write ENDARC, but our volume code expected it. Fix that.
|
||||
* RAR 2.x: Support more than 200 old-style volumes.
|
||||
|
||||
Cleanups:
|
||||
|
||||
* Load comment only when requested.
|
||||
* Cleanup of internal config variables. They should have now final names.
|
||||
* :meth:`RarFile.open`: Add mode=r argument to match zipfile.
|
||||
* Doc and comments cleanup, minimize duplication.
|
||||
* Common wrappers for both compressed and uncompressed files,
|
||||
now :meth:`RarFile.open` also does CRC-checking.
|
||||
|
||||
Version 2.0 (2010-04-29)
|
||||
------------------------
|
||||
|
||||
Features:
|
||||
|
||||
* Python 3 support. Still works with 2.x.
|
||||
* Parses extended time fields. (.mtime, .ctime, .atime)
|
||||
* :meth:`RarFile.open` method. This makes possible to process large
|
||||
entries that do not fit into memory.
|
||||
* Supports password-protected archives.
|
||||
* Supports archive comments.
|
||||
|
||||
Cleanups:
|
||||
|
||||
* Uses :mod:`subprocess` module to launch ``unrar``.
|
||||
* .filename is always Unicode string, .unicode_filename is now deprecated.
|
||||
* .CRC is unsigned again, as python3 crc32() is unsigned.
|
||||
|
||||
Version 1.1 (2008-08-31)
|
||||
------------------------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Replace :func:`os.tempnam` with :func:`tempfile.mkstemp`. (Jason Moiron)
|
||||
* Fix infinite loop in _extract_hack on unexpected EOF
|
||||
* :attr:`RarInfo.CRC` is now signed value to match crc32()
|
||||
* :meth:`RarFile.read` now checks file crc
|
||||
|
||||
Cleanups:
|
||||
|
||||
* more docstrings
|
||||
* throw proper exceptions (subclasses of :exc:`rarfile.Error`)
|
||||
* RarInfo has fields pre-initialized, so they appear in help()
|
||||
* rename RarInfo.data to RarInfo.header_data
|
||||
* dont use "print" when header parsing fails
|
||||
* use try/finally to delete temp rar
|
||||
|
||||
Version 1.0 (2005-08-08)
|
||||
------------------------
|
||||
|
||||
* First release.
|
||||
|
|
@ -1,361 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
"""Dump archive contents, test extraction."""
|
||||
|
||||
import io
|
||||
import sys
|
||||
import rarfile as rf
|
||||
from binascii import crc32, hexlify
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
bytearray
|
||||
except NameError:
|
||||
import array
|
||||
def bytearray(v):
|
||||
return array.array('B', v)
|
||||
|
||||
rf.UNICODE_COMMENTS = 1
|
||||
rf.USE_DATETIME = 1
|
||||
|
||||
usage = """
|
||||
dumprar [switches] [ARC1 ARC2 ...] [@ARCLIST]
|
||||
switches:
|
||||
@file read archive names from file
|
||||
-pPSW set password
|
||||
-Ccharset set fallback charset
|
||||
-v increase verbosity
|
||||
-t attempt to read all files
|
||||
-x write read files out
|
||||
-c show archive comment
|
||||
-h show usage
|
||||
-- stop switch parsing
|
||||
""".strip()
|
||||
|
||||
os_list = ['DOS', 'OS2', 'WIN', 'UNIX', 'MACOS', 'BEOS']
|
||||
|
||||
block_strs = ['MARK', 'MAIN', 'FILE', 'OLD_COMMENT', 'OLD_EXTRA',
|
||||
'OLD_SUB', 'OLD_RECOVERY', 'OLD_AUTH', 'SUB', 'ENDARC']
|
||||
|
||||
def rarType(type):
|
||||
if type < rf.RAR_BLOCK_MARK or type > rf.RAR_BLOCK_ENDARC:
|
||||
return "*UNKNOWN*"
|
||||
return block_strs[type - rf.RAR_BLOCK_MARK]
|
||||
|
||||
main_bits = (
|
||||
(rf.RAR_MAIN_VOLUME, "VOL"),
|
||||
(rf.RAR_MAIN_COMMENT, "COMMENT"),
|
||||
(rf.RAR_MAIN_LOCK, "LOCK"),
|
||||
(rf.RAR_MAIN_SOLID, "SOLID"),
|
||||
(rf.RAR_MAIN_NEWNUMBERING, "NEWNR"),
|
||||
(rf.RAR_MAIN_AUTH, "AUTH"),
|
||||
(rf.RAR_MAIN_RECOVERY, "RECOVERY"),
|
||||
(rf.RAR_MAIN_PASSWORD, "PASSWORD"),
|
||||
(rf.RAR_MAIN_FIRSTVOLUME, "FIRSTVOL"),
|
||||
(rf.RAR_SKIP_IF_UNKNOWN, "SKIP"),
|
||||
(rf.RAR_LONG_BLOCK, "LONG"),
|
||||
)
|
||||
|
||||
endarc_bits = (
|
||||
(rf.RAR_ENDARC_NEXT_VOLUME, "NEXTVOL"),
|
||||
(rf.RAR_ENDARC_DATACRC, "DATACRC"),
|
||||
(rf.RAR_ENDARC_REVSPACE, "REVSPACE"),
|
||||
(rf.RAR_ENDARC_VOLNR, "VOLNR"),
|
||||
(rf.RAR_SKIP_IF_UNKNOWN, "SKIP"),
|
||||
(rf.RAR_LONG_BLOCK, "LONG"),
|
||||
)
|
||||
|
||||
file_bits = (
|
||||
(rf.RAR_FILE_SPLIT_BEFORE, "SPLIT_BEFORE"),
|
||||
(rf.RAR_FILE_SPLIT_AFTER, "SPLIT_AFTER"),
|
||||
(rf.RAR_FILE_PASSWORD, "PASSWORD"),
|
||||
(rf.RAR_FILE_COMMENT, "COMMENT"),
|
||||
(rf.RAR_FILE_SOLID, "SOLID"),
|
||||
(rf.RAR_FILE_LARGE, "LARGE"),
|
||||
(rf.RAR_FILE_UNICODE, "UNICODE"),
|
||||
(rf.RAR_FILE_SALT, "SALT"),
|
||||
(rf.RAR_FILE_VERSION, "VERSION"),
|
||||
(rf.RAR_FILE_EXTTIME, "EXTTIME"),
|
||||
(rf.RAR_FILE_EXTFLAGS, "EXTFLAGS"),
|
||||
(rf.RAR_SKIP_IF_UNKNOWN, "SKIP"),
|
||||
(rf.RAR_LONG_BLOCK, "LONG"),
|
||||
)
|
||||
|
||||
generic_bits = (
|
||||
(rf.RAR_SKIP_IF_UNKNOWN, "SKIP"),
|
||||
(rf.RAR_LONG_BLOCK, "LONG"),
|
||||
)
|
||||
|
||||
file_parms = ("D64", "D128", "D256", "D512",
|
||||
"D1024", "D2048", "D4096", "DIR")
|
||||
|
||||
def xprint(m, *args):
|
||||
if sys.hexversion < 0x3000000:
|
||||
m = m.decode('utf8')
|
||||
if args:
|
||||
m = m % args
|
||||
if sys.hexversion < 0x3000000:
|
||||
m = m.encode('utf8')
|
||||
sys.stdout.write(m)
|
||||
sys.stdout.write('\n')
|
||||
|
||||
def render_flags(flags, bit_list):
|
||||
res = []
|
||||
known = 0
|
||||
for bit in bit_list:
|
||||
known = known | bit[0]
|
||||
if flags & bit[0]:
|
||||
res.append(bit[1])
|
||||
unknown = flags & ~known
|
||||
n = 0
|
||||
while unknown:
|
||||
if unknown & 1:
|
||||
res.append("UNK_%04x" % (1 << n))
|
||||
unknown = unknown >> 1
|
||||
n += 1
|
||||
|
||||
return ",".join(res)
|
||||
|
||||
def get_file_flags(flags):
|
||||
res = render_flags(flags & ~rf.RAR_FILE_DICTMASK, file_bits)
|
||||
|
||||
xf = (flags & rf.RAR_FILE_DICTMASK) >> 5
|
||||
res += "," + file_parms[xf]
|
||||
return res
|
||||
|
||||
def get_main_flags(flags):
|
||||
return render_flags(flags, main_bits)
|
||||
|
||||
def get_endarc_flags(flags):
|
||||
return render_flags(flags, endarc_bits)
|
||||
|
||||
def get_generic_flags(flags):
|
||||
return render_flags(flags, generic_bits)
|
||||
|
||||
def fmt_time(t):
|
||||
if isinstance(t, datetime):
|
||||
return t.isoformat(' ')
|
||||
return "%04d-%02d-%02d %02d:%02d:%02d" % t
|
||||
|
||||
def show_item(h):
|
||||
st = rarType(h.type)
|
||||
unknown = h.header_size - h.header_base
|
||||
xprint("%s: hdrlen=%d datlen=%d hdr_unknown=%d", st, h.header_size,
|
||||
h.add_size, unknown)
|
||||
if unknown > 0 and cf_verbose > 1:
|
||||
dat = h.header_data[h.header_base : ]
|
||||
xprint(" unknown: %s", hexlify(dat))
|
||||
if h.type in (rf.RAR_BLOCK_FILE, rf.RAR_BLOCK_SUB):
|
||||
if h.host_os == rf.RAR_OS_UNIX:
|
||||
s_mode = "0%o" % h.mode
|
||||
else:
|
||||
s_mode = "0x%x" % h.mode
|
||||
xprint(" flags=0x%04x:%s", h.flags, get_file_flags(h.flags))
|
||||
if h.host_os >= 0 and h.host_os < len(os_list):
|
||||
s_os = os_list[h.host_os]
|
||||
else:
|
||||
s_os = "?"
|
||||
xprint(" os=%d:%s ver=%d mode=%s meth=%c cmp=%d dec=%d vol=%d",
|
||||
h.host_os, s_os,
|
||||
h.extract_version, s_mode, h.compress_type,
|
||||
h.compress_size, h.file_size, h.volume)
|
||||
ucrc = (h.CRC + (1 << 32)) & ((1 << 32) - 1)
|
||||
xprint(" crc=0x%08x (%d) time=%s", ucrc, h.CRC, fmt_time(h.date_time))
|
||||
xprint(" name=%s", h.filename)
|
||||
if h.mtime:
|
||||
xprint(" mtime=%s", fmt_time(h.mtime))
|
||||
if h.ctime:
|
||||
xprint(" ctime=%s", fmt_time(h.ctime))
|
||||
if h.atime:
|
||||
xprint(" atime=%s", fmt_time(h.atime))
|
||||
if h.arctime:
|
||||
xprint(" arctime=%s", fmt_time(h.arctime))
|
||||
elif h.type == rf.RAR_BLOCK_MAIN:
|
||||
xprint(" flags=0x%04x:%s", h.flags, get_main_flags(h.flags))
|
||||
elif h.type == rf.RAR_BLOCK_ENDARC:
|
||||
xprint(" flags=0x%04x:%s", h.flags, get_endarc_flags(h.flags))
|
||||
elif h.type == rf.RAR_BLOCK_MARK:
|
||||
xprint(" flags=0x%04x:", h.flags)
|
||||
else:
|
||||
xprint(" flags=0x%04x:%s", h.flags, get_generic_flags(h.flags))
|
||||
|
||||
if h.comment is not None:
|
||||
cm = repr(h.comment)
|
||||
if cm[0] == 'u':
|
||||
cm = cm[1:]
|
||||
xprint(" comment=%s", cm)
|
||||
|
||||
cf_show_comment = 0
|
||||
cf_verbose = 0
|
||||
cf_charset = None
|
||||
cf_extract = 0
|
||||
cf_test_read = 0
|
||||
cf_test_unrar = 0
|
||||
cf_test_memory = 0
|
||||
|
||||
def check_crc(f, inf):
|
||||
ucrc = f.CRC
|
||||
if ucrc < 0:
|
||||
ucrc += (long(1) << 32)
|
||||
if ucrc != inf.CRC:
|
||||
print ('crc error')
|
||||
|
||||
def test_read_long(r, inf):
|
||||
f = r.open(inf.filename)
|
||||
total = 0
|
||||
while 1:
|
||||
data = f.read(8192)
|
||||
if not data:
|
||||
break
|
||||
total += len(data)
|
||||
if total != inf.file_size:
|
||||
xprint("\n *** %s has corrupt file: %s ***", r.rarfile, inf.filename)
|
||||
xprint(" *** short read: got=%d, need=%d ***\n", total, inf.file_size)
|
||||
check_crc(f, inf)
|
||||
|
||||
# test .seek() & .readinto()
|
||||
if cf_test_read > 1:
|
||||
f.seek(0,0)
|
||||
|
||||
# hack: re-enable crc calc
|
||||
f.crc_check = 1
|
||||
f.CRC = 0
|
||||
|
||||
total = 0
|
||||
buf = bytearray(rf.ZERO*4096)
|
||||
while 1:
|
||||
res = f.readinto(buf)
|
||||
if not res:
|
||||
break
|
||||
total += res
|
||||
if inf.file_size != total:
|
||||
xprint(" *** readinto failed: got=%d, need=%d ***\n", total, inf.file_size)
|
||||
check_crc(f, inf)
|
||||
f.close()
|
||||
|
||||
def test_read(r, inf):
|
||||
test_read_long(r, inf)
|
||||
|
||||
|
||||
def test_real(fn, psw):
|
||||
xprint("Archive: %s", fn)
|
||||
|
||||
cb = None
|
||||
if cf_verbose > 1:
|
||||
cb = show_item
|
||||
|
||||
rfarg = fn
|
||||
if cf_test_memory:
|
||||
rfarg = io.BytesIO(open(fn, 'rb').read())
|
||||
|
||||
# check if rar
|
||||
if not rf.is_rarfile(rfarg):
|
||||
xprint(" --- %s is not a RAR file ---", fn)
|
||||
return
|
||||
|
||||
# open
|
||||
r = rf.RarFile(rfarg, charset = cf_charset, info_callback = cb)
|
||||
# set password
|
||||
if r.needs_password():
|
||||
if psw:
|
||||
r.setpassword(psw)
|
||||
else:
|
||||
xprint(" --- %s requires password ---", fn)
|
||||
return
|
||||
|
||||
# show comment
|
||||
if cf_show_comment and r.comment:
|
||||
for ln in r.comment.split('\n'):
|
||||
xprint(" %s", ln)
|
||||
elif cf_verbose == 1 and r.comment:
|
||||
cm = repr(r.comment)
|
||||
if cm[0] == 'u':
|
||||
cm = cm[1:]
|
||||
xprint(" comment=%s", cm)
|
||||
|
||||
# process
|
||||
for n in r.namelist():
|
||||
inf = r.getinfo(n)
|
||||
if inf.isdir():
|
||||
continue
|
||||
if cf_verbose == 1:
|
||||
show_item(inf)
|
||||
if cf_test_read:
|
||||
test_read(r, inf)
|
||||
|
||||
if cf_extract:
|
||||
r.extractall()
|
||||
for inf in r.infolist():
|
||||
r.extract(inf)
|
||||
|
||||
if cf_test_unrar:
|
||||
r.testrar()
|
||||
|
||||
def test(fn, psw):
|
||||
try:
|
||||
test_real(fn, psw)
|
||||
except rf.NeedFirstVolume:
|
||||
xprint(" --- %s is middle part of multi-vol archive ---", fn)
|
||||
except rf.Error:
|
||||
exc, msg, tb = sys.exc_info()
|
||||
xprint("\n *** %s: %s ***\n", exc.__name__, msg)
|
||||
del tb
|
||||
except IOError:
|
||||
exc, msg, tb = sys.exc_info()
|
||||
xprint("\n *** %s: %s ***\n", exc.__name__, msg)
|
||||
del tb
|
||||
|
||||
def main():
|
||||
global cf_verbose, cf_show_comment, cf_charset
|
||||
global cf_extract, cf_test_read, cf_test_unrar
|
||||
global cf_test_memory
|
||||
|
||||
# parse args
|
||||
args = []
|
||||
psw = None
|
||||
noswitch = False
|
||||
for a in sys.argv[1:]:
|
||||
if noswitch:
|
||||
args.append(a)
|
||||
elif a[0] == "@":
|
||||
for ln in open(a[1:], 'r'):
|
||||
fn = ln[:-1]
|
||||
args.append(fn)
|
||||
elif a[0] != '-':
|
||||
args.append(a)
|
||||
elif a[1] == 'p':
|
||||
psw = a[2:]
|
||||
elif a == '--':
|
||||
noswitch = True
|
||||
elif a == '-h':
|
||||
xprint(usage)
|
||||
return
|
||||
elif a == '-v':
|
||||
cf_verbose += 1
|
||||
elif a == '-c':
|
||||
cf_show_comment = 1
|
||||
elif a == '-x':
|
||||
cf_extract = 1
|
||||
elif a == '-t':
|
||||
cf_test_read += 1
|
||||
elif a == '-T':
|
||||
cf_test_unrar = 1
|
||||
elif a == '-M':
|
||||
cf_test_memory = 1
|
||||
elif a[1] == 'C':
|
||||
cf_charset = a[2:]
|
||||
else:
|
||||
raise Exception("unknown switch: "+a)
|
||||
if not args:
|
||||
xprint(usage)
|
||||
|
||||
for fn in args:
|
||||
test(fn, psw)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
import rarfile
|
||||
|
||||
ver = rarfile.__version__
|
||||
ldesc = open("README.rst").read().strip()
|
||||
sdesc = ldesc.split('\n')[0].split(' - ')[1].strip()
|
||||
|
||||
setup(
|
||||
name = "rarfile",
|
||||
version = ver,
|
||||
description = sdesc,
|
||||
long_description = ldesc,
|
||||
author = "Marko Kreen",
|
||||
license = "ISC",
|
||||
author_email = "markokr@gmail.com",
|
||||
url = "https://github.com/markokr/rarfile",
|
||||
py_modules = ['rarfile'],
|
||||
keywords = ['rar', 'unrar', 'archive'],
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: ISC License (ISCL)",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: System :: Archiving :: Compression",
|
||||
]
|
||||
)
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
test:
|
||||
./test1.sh
|
||||
./test2.sh
|
||||
|
||||
clean:
|
||||
rm -rf __pycache__
|
||||
rm -f files/*.rar.[pj]* *.pyc *.class *.diffs
|
||||
rm -f rarfile.py
|
||||
|
Binary file not shown.
|
@ -1,7 +0,0 @@
|
|||
Archive: files/ctime0.rar
|
||||
FILE: hdrlen=46 datlen=0 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=2:WIN ver=29 mode=0x20 meth=0 cmp=0 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2011-05-10 21:28:47.899345
|
||||
name=afile.txt
|
||||
mtime=2011-05-10 21:28:47.899345
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
Archive: files/ctime1.rar
|
||||
FILE: hdrlen=50 datlen=0 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=2:WIN ver=29 mode=0x20 meth=0 cmp=0 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2011-05-10 21:28:47.899345
|
||||
name=afile.txt
|
||||
mtime=2011-05-10 21:28:47.899345
|
||||
ctime=2011-05-10 21:28:47
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
Archive: files/ctime2.rar
|
||||
FILE: hdrlen=51 datlen=0 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=2:WIN ver=29 mode=0x20 meth=0 cmp=0 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2011-05-10 21:28:47.899345
|
||||
name=afile.txt
|
||||
mtime=2011-05-10 21:28:47.899345
|
||||
ctime=2011-05-10 21:28:47.897843
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
Archive: files/ctime3.rar
|
||||
FILE: hdrlen=52 datlen=0 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=2:WIN ver=29 mode=0x20 meth=0 cmp=0 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2011-05-10 21:28:47.899345
|
||||
name=afile.txt
|
||||
mtime=2011-05-10 21:28:47.899345
|
||||
ctime=2011-05-10 21:28:47.899327
|
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
Archive: files/ctime4.rar
|
||||
FILE: hdrlen=53 datlen=0 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=2:WIN ver=29 mode=0x20 meth=0 cmp=0 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2011-05-10 21:28:47.899345
|
||||
name=afile.txt
|
||||
mtime=2011-05-10 21:28:47.899345
|
||||
ctime=2011-05-10 21:28:47.899345
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
Archive: files/rar15-comment-lock.rar
|
||||
comment='RARcomment -----'
|
||||
FILE: hdrlen=72 datlen=7 hdr_unknown=31
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=15 mode=0x20 meth=3 cmp=7 dec=7 vol=0
|
||||
crc=0xe27f07a9 (3799975849) time=2010-11-03 19:49:32
|
||||
name=FILE1.TXT
|
||||
comment='file1comment -----'
|
||||
FILE: hdrlen=72 datlen=8 hdr_unknown=31
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=15 mode=0x20 meth=0 cmp=8 dec=8 vol=0
|
||||
crc=0x3c4306f7 (1011025655) time=2010-11-03 19:49:38
|
||||
name=FILE2.TXT
|
||||
comment='file2comment -----'
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
Archive: files/rar15-comment.rar
|
||||
comment='RARcomment -----'
|
||||
FILE: hdrlen=72 datlen=7 hdr_unknown=31
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=15 mode=0x20 meth=3 cmp=7 dec=7 vol=0
|
||||
crc=0xe27f07a9 (3799975849) time=2010-11-03 19:49:32
|
||||
name=FILE1.TXT
|
||||
comment='file1comment -----'
|
||||
FILE: hdrlen=72 datlen=8 hdr_unknown=31
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=15 mode=0x20 meth=0 cmp=8 dec=8 vol=0
|
||||
crc=0x3c4306f7 (1011025655) time=2010-11-03 19:49:38
|
||||
name=FILE2.TXT
|
||||
comment='file2comment -----'
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
Archive: files/rar202-comment-nopsw.rar
|
||||
comment='RARcomment'
|
||||
FILE: hdrlen=66 datlen=7 hdr_unknown=25
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=20 mode=0x20 meth=0 cmp=7 dec=7 vol=0
|
||||
crc=0x7a197dba (2048490938) time=2010-11-03 00:27:28
|
||||
name=FILE1.TXT
|
||||
comment='file1comment'
|
||||
FILE: hdrlen=66 datlen=7 hdr_unknown=25
|
||||
flags=0x8008:COMMENT,LONG,D64
|
||||
os=0:DOS ver=20 mode=0x20 meth=0 cmp=7 dec=7 vol=0
|
||||
crc=0x785fc3e3 (2019541987) time=2010-11-03 00:27:34
|
||||
name=FILE2.TXT
|
||||
comment='file2comment'
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
Archive: files/rar202-comment-psw.rar
|
||||
comment='RARcomment'
|
||||
FILE: hdrlen=66 datlen=32 hdr_unknown=25
|
||||
flags=0x800c:PASSWORD,COMMENT,LONG,D64
|
||||
os=0:DOS ver=20 mode=0x20 meth=3 cmp=32 dec=7 vol=0
|
||||
crc=0x7a197dba (2048490938) time=2010-11-03 00:27:28
|
||||
name=FILE1.TXT
|
||||
comment='file1comment'
|
||||
FILE: hdrlen=66 datlen=32 hdr_unknown=25
|
||||
flags=0x800c:PASSWORD,COMMENT,LONG,D64
|
||||
os=0:DOS ver=20 mode=0x20 meth=3 cmp=32 dec=7 vol=0
|
||||
crc=0x785fc3e3 (2019541987) time=2010-11-03 00:27:34
|
||||
name=FILE2.TXT
|
||||
comment='file2comment'
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
Archive: files/rar3-comment-hpsw.rar
|
||||
comment='RARcomment\n'
|
||||
FILE: hdrlen=51 datlen=16 hdr_unknown=0
|
||||
flags=0x9424:PASSWORD,SALT,EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=16 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file1.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment1v2\n'
|
||||
FILE: hdrlen=51 datlen=16 hdr_unknown=0
|
||||
flags=0x9424:PASSWORD,SALT,EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=16 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file2.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment2v2\n'
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
Archive: files/rar3-comment-plain.rar
|
||||
comment='RARcomment\n'
|
||||
FILE: hdrlen=43 datlen=8 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=8 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file1.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment1v2\n'
|
||||
FILE: hdrlen=43 datlen=8 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=8 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file2.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment2v2\n'
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
Archive: files/rar3-comment-psw.rar
|
||||
comment='RARcomment\n'
|
||||
FILE: hdrlen=51 datlen=16 hdr_unknown=0
|
||||
flags=0x9424:PASSWORD,SALT,EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=16 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file1.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment1v2\n'
|
||||
FILE: hdrlen=51 datlen=16 hdr_unknown=0
|
||||
flags=0x9424:PASSWORD,SALT,EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=3 cmp=16 dec=0 vol=0
|
||||
crc=0x00000000 (0) time=2010-11-02 10:03:25
|
||||
name=file2.txt
|
||||
mtime=2010-11-02 10:03:25
|
||||
comment='Comment2v2\n'
|
Binary file not shown.
|
@ -1,13 +0,0 @@
|
|||
Archive: files/seektest.rar
|
||||
FILE: hdrlen=44 datlen=90 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=29 mode=0100644 meth=5 cmp=90 dec=2048 vol=0
|
||||
crc=0xc5b7e6a2 (3317163682) time=2011-06-12 12:53:33
|
||||
name=stest1.txt
|
||||
mtime=2011-06-12 12:53:33
|
||||
FILE: hdrlen=44 datlen=2048 hdr_unknown=0
|
||||
flags=0x9020:EXTTIME,LONG,D128
|
||||
os=3:UNIX ver=20 mode=0100644 meth=0 cmp=2048 dec=2048 vol=0
|
||||
crc=0xc5b7e6a2 (3317163682) time=2011-06-12 12:53:33
|
||||
name=stest2.txt
|
||||
mtime=2011-06-12 12:53:33
|
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
Archive: files/unicode.rar
|
||||
FILE: hdrlen=54 datlen=17 hdr_unknown=0
|
||||
flags=0x8080:LONG,D1024
|
||||
os=3:UNIX ver=29 mode=0100644 meth=5 cmp=17 dec=2 vol=0
|
||||
crc=0x6751fc53 (1733426259) time=2011-07-06 16:48:04
|
||||
name=уииоотивл.txt
|
||||
FILE: hdrlen=52 datlen=13 hdr_unknown=0
|
||||
flags=0x8090:SOLID,LONG,D1024
|
||||
os=3:UNIX ver=29 mode=0100644 meth=5 cmp=13 dec=2 vol=0
|
||||
crc=0x6751fc53 (1733426259) time=2011-07-06 16:48:04
|
||||
name=𝐀𝐁𝐁𝐂.txt
|
|
@ -1,32 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
PYTHONPATH=..:$PYTHONPATH
|
||||
export PYTHONPATH
|
||||
|
||||
JAVA_OPTIONS="-Dpython.path=`pwd`/.."
|
||||
export JAVA_OPTIONS
|
||||
|
||||
plist="python2.7 python3.2 python3.3 python3.4 python3.5 python3.6 pypy jython jython2.7"
|
||||
|
||||
rm -f test.diffs
|
||||
|
||||
for py in $plist; do
|
||||
if which $py > /dev/null; then
|
||||
for f in files/*.rar; do
|
||||
printf "%s -> %-30s .. " $py $f
|
||||
$py ../dumprar.py -t -t -v -ppassword $f > $f.$py
|
||||
if diff -uw $f.exp $f.$py > /dev/null; then
|
||||
echo "ok"
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "#### $py ####" >> test.diffs
|
||||
diff -uw $f.exp $f.$py >> test.diffs
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
else
|
||||
echo $py not available
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
cp ../rarfile.py .
|
||||
|
||||
#ulimit -n 16
|
||||
|
||||
plist="python2.7 python3.2 python3.3 python3.4 python3.5 python3.6 pypy jython jython2.7"
|
||||
|
||||
for py in $plist; do
|
||||
if which $py > /dev/null; then
|
||||
echo "== $py =="
|
||||
$py ./testseek.py
|
||||
$py ./testio.py
|
||||
$py ./testcorrupt.py --quick
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f rarfile.py
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
import rarfile
|
||||
import sys, os, time
|
||||
import tempfile
|
||||
|
||||
def progress():
|
||||
sys.stdout.write('.')
|
||||
sys.stdout.flush()
|
||||
|
||||
def try_read(tmpfn):
|
||||
#progress()
|
||||
try:
|
||||
rf = rarfile.RarFile(tmpfn)
|
||||
if rf.needs_password():
|
||||
rf.setpassword('password')
|
||||
except rarfile.Error:
|
||||
return
|
||||
for fn in rf.namelist():
|
||||
try:
|
||||
data = rf.read(fn)
|
||||
pass
|
||||
except rarfile.Error:
|
||||
pass
|
||||
|
||||
def test_rar(rarfn):
|
||||
data = open(rarfn, "rb").read()
|
||||
|
||||
fd, tmpfn = tempfile.mkstemp('.rar')
|
||||
os.close(fd)
|
||||
|
||||
print('testcorrupt 1')
|
||||
for n in range(len(data)):
|
||||
bad = data[:n]
|
||||
f = open(tmpfn, 'wb')
|
||||
f.write(bad)
|
||||
f.close()
|
||||
|
||||
try_read(tmpfn)
|
||||
|
||||
print('testcorrupt 2')
|
||||
crap = rarfile.RAR_ID
|
||||
for n in range(1, len(data)):
|
||||
for i in range(len(crap)):
|
||||
c = crap[i:i+1]
|
||||
bad = data[:n - 1] + c + data[n:]
|
||||
f = open(tmpfn, 'wb')
|
||||
f.write(bad)
|
||||
f.close()
|
||||
try_read(tmpfn)
|
||||
|
||||
os.unlink(tmpfn)
|
||||
|
||||
test_rar_list = [
|
||||
"files/ctime0.rar",
|
||||
"files/ctime1.rar",
|
||||
"files/ctime2.rar",
|
||||
"files/ctime3.rar",
|
||||
"files/ctime4.rar",
|
||||
"files/seektest.rar",
|
||||
"files/rar15-comment-lock.rar",
|
||||
"files/rar15-comment.rar",
|
||||
"files/rar202-comment-nopsw.rar",
|
||||
"files/rar202-comment-psw.rar",
|
||||
"files/rar3-comment-hpsw.rar",
|
||||
"files/rar3-comment-plain.rar",
|
||||
"files/rar3-comment-psw.rar",
|
||||
"files/unicode.rar",
|
||||
]
|
||||
|
||||
def main():
|
||||
if sys.argv[-1] == '--quick':
|
||||
test_rar("files/rar3-comment-plain.rar")
|
||||
return
|
||||
for rar in test_rar_list:
|
||||
print(rar)
|
||||
test_rar(rar)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except OSError:
|
||||
print('OSError: pid = %d' % os.getpid())
|
||||
time.sleep(80000)
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
import rarfile, os, os.path, time, sys
|
||||
|
||||
try:
|
||||
from io import BufferedReader, TextIOWrapper
|
||||
except ImportError:
|
||||
print('no io module')
|
||||
sys.exit(0)
|
||||
def BufferedReader(x): return x
|
||||
def TextIOWrapper(x): return x
|
||||
|
||||
def test_readline(rf, fn):
|
||||
f = rf.open(fn)
|
||||
tr = TextIOWrapper(BufferedReader(f))
|
||||
while 1:
|
||||
ln = tr.readline()
|
||||
if not ln:
|
||||
break
|
||||
tr.close()
|
||||
|
||||
def main():
|
||||
files = ['stest1.txt', 'stest2.txt']
|
||||
arc = 'files/seektest.rar'
|
||||
|
||||
rf = rarfile.RarFile(arc, crc_check=0)
|
||||
for fn in files:
|
||||
sys.stdout.write('test/readline: %s .. ' % fn)
|
||||
sys.stdout.flush()
|
||||
test_readline(rf, fn)
|
||||
print('ok')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
import rarfile, os, os.path, time, sys
|
||||
|
||||
def show_fds():
|
||||
fdir = "/proc/%d/fd" % os.getpid()
|
||||
if os.path.isdir(fdir):
|
||||
os.system('printf "fds = "; ls -l %s | wc -l' % fdir)
|
||||
|
||||
def do_seek(f, pos, lim):
|
||||
ofs = pos*4
|
||||
fsize = lim*4
|
||||
|
||||
if ofs < 0:
|
||||
exp = 0
|
||||
elif ofs > fsize:
|
||||
exp = fsize
|
||||
else:
|
||||
exp = ofs
|
||||
|
||||
f.seek(ofs)
|
||||
|
||||
got = f.tell()
|
||||
|
||||
if got != exp:
|
||||
raise Exception('seek failed (got=%d, exp=%d)' % (got, exp))
|
||||
ln = f.read(4)
|
||||
if got == fsize and ln:
|
||||
raise Exception('unexpected read')
|
||||
if not ln and got < fsize:
|
||||
raise Exception('unexpected read failure')
|
||||
if ln:
|
||||
spos = int(ln)
|
||||
if spos*4 != got:
|
||||
raise Exception('unexpected pos: spos=%d pos=%d' % (spos, pos))
|
||||
|
||||
def test_seek(rf, fn):
|
||||
inf = rf.getinfo(fn)
|
||||
cnt = int(inf.file_size / 4)
|
||||
f = rf.open(fn)
|
||||
|
||||
do_seek(f, int(cnt/2), cnt)
|
||||
do_seek(f, 0, cnt)
|
||||
|
||||
for i in range(int(cnt/2)):
|
||||
do_seek(f, i*2, cnt)
|
||||
|
||||
for i in range(cnt):
|
||||
do_seek(f, i*2 - int(cnt / 2), cnt)
|
||||
|
||||
for i in range(cnt + 10):
|
||||
do_seek(f, cnt - i - 5, cnt)
|
||||
|
||||
f.close()
|
||||
|
||||
print('OK')
|
||||
|
||||
def test_arc(arc, desc):
|
||||
files = ['stest1.txt', 'stest2.txt']
|
||||
rf = rarfile.RarFile(arc, crc_check=0)
|
||||
for fn in files:
|
||||
sys.stdout.write('%s | test/seek %s .. ' % (desc, fn))
|
||||
sys.stdout.flush()
|
||||
test_seek(rf, fn)
|
||||
|
||||
def main():
|
||||
arc = 'files/seektest.rar'
|
||||
data = open(arc, 'rb').read()
|
||||
|
||||
# filename
|
||||
test_arc(arc, "fn")
|
||||
|
||||
# filelike: cStringIO
|
||||
try:
|
||||
import cStringIO
|
||||
test_arc(cStringIO.StringIO(data), "cStringIO")
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# filelike: io.BytesIO, io.open()
|
||||
try:
|
||||
import io
|
||||
test_arc(io.BytesIO(data), "io.BytesIO")
|
||||
test_arc(io.open(arc, 'rb'), "io.open")
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# filelike: StringIO
|
||||
try:
|
||||
import StringIO
|
||||
test_arc(StringIO.StringIO(data), "StringIO")
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# filelike: file()
|
||||
test_arc(open(arc, 'rb'), "file")
|
||||
|
||||
time.sleep(1)
|
||||
show_fds()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue