Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Jun 16, 2016
2 parents 122fb50 + e9a0366 commit 3569224
Show file tree
Hide file tree
Showing 22 changed files with 627 additions and 82 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python
python:
- "2.6"
- "2.7"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y par2
install:
- pip install -U setuptools
- python bootstrap.py
- ./bin/buildout
before_script:
- ./bin/flake8 easy_extract
script:
- ./bin/cover
after_success:
- ./bin/coveralls
notifications:
irc:
- "irc.freenode.org#easy-extract"
35 changes: 18 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@ Installation

Before you start using easy-extract, you must install these softwares :

* unrar-free
* 7zip-full
* par2
* unrar-free
* 7zip-full
* par2

Then use easy_install
Then use easy_install: ::

$> easy_install easy-extract
$ easy_install easy-extract

Usage
-----

Usage: easy_extract [options] [directory]...

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-f, --force Do not prompt confirmation message
-n, --not-repair Do not try to repair archives on errors
-c, --repair-only Do only a check and repair operation
-r, --recursive Find archives recursively
--version show program's version number and exit
-h, --help show this help message and exit
-f, --force Do not prompt confirmation message
-n, --not-repair Do not try to repair archives on errors
-c, --repair-only Do only a check and repair operation
-r, --recursive Find archives recursively
-k, --keep Do not delete archives on success
-x, --no-index Do not index the extracted files

Simply run **easy_extract** in the directory where the collections are.
Simply run **easy_extract** in the directory where the collections are: ::

$> easy_extract
$ easy_extract

or for finding archives recursivly in a directory.
To find archives recursively in a directory: ::

$> easy_extract -r my_archives/
$ easy_extract -r my_archives/

All the archives found will be prompted, then confirm the extraction.
Go make a coffee, the script will do the rest !
Expand All @@ -50,11 +52,10 @@ Easy_extract will handle the repair if the archives are corrupted.
Code
----

If you want to reuse the code to find archives you can do something like that :
If you want to reuse the code to find archives you can do something like that : ::

>>> from easy_extract.archive_finder import ArchiveFinder
>>> from easy_extract.archives.rar import RarArchive
>>>
>>> archive_finder = ArchiveFinder('./my_path/', recursive=True, archive_classes=[RarArchive,])
>>> archive_finder.archives
... [<easy_extract.archives.rar.RarArchive object at 0x...>, <easy_extract.archives.rar.RarArchive object at 0x...>]
189 changes: 189 additions & 0 deletions bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""

import os
import shutil
import sys
import tempfile

from optparse import OptionParser

tmpeggs = tempfile.mkdtemp()

usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Bootstraps a buildout-based project.
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''

parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")

parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
help=("Normally, if you do not specify a --version, the "
"bootstrap script and buildout gets the newest "
"*final* versions of zc.buildout and its recipes and "
"extensions for you. If you use this flag, "
"bootstrap and buildout will get the newest releases "
"even if they are alphas or betas."))
parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration "
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")


options, args = parser.parse_args()

######################################################################
# load/install setuptools

try:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen

ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)

if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]

setup_args = dict(to_dir=tmpeggs, download_delay=0)

if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version

ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources

# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)

######################################################################
# Install buildout

ws = pkg_resources.working_set

cmd = [sys.executable, '-c',
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]

find_links = os.environ.get(
'bootstrap-testing-find-links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
)
if find_links:
cmd.extend(['-f', find_links])

setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location

requirement = 'zc.buildout'
version = options.version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
_final_parts = '*final-', '*final'

def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True

index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
index.add_find_links((find_links,))
req = pkg_resources.Requirement.parse(requirement)
if index.obtain(req) is not None:
best = []
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
bestv = distv
elif distv == bestv:
best.append(dist)
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
cmd.append(requirement)

import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

######################################################################
# Import and run buildout

ws.add_entry(tmpeggs)
ws.require(requirement)
import zc.buildout.buildout

if not [a for a in args if '=' not in a]:
args.append('bootstrap')

# if -c was provided, we push it back into args for buildout' main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]

zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)
64 changes: 64 additions & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[buildout]
develop = .
parts = easy-extract
test
cover
flake8
evolve
coveralls
show-picked-versions = true

[easy-extract]
eggs = easy-extract
recipe = zc.recipe.egg

[test]
defaults = --with-progressive
eggs = nose
nose-progressive
easy-extract
recipe = pbp.recipe.noserunner

[cover]
<= test
defaults = --with-coverage
--cover-erase
--cover-package=easy_extract
eggs = nose
coverage
easy-extract

[flake8]
eggs = flake8
recipe = zc.recipe.egg

[evolve]
arguments = 'buildout.cfg -w --sorting alpha'
eggs = buildout-versions-checker
recipe = zc.recipe.egg
scripts = check-buildout-updates=${:_buildout_section_name_}

[coveralls]
eggs = python-coveralls
recipe = zc.recipe.egg

[versions]
blessings = 1.6
buildout-versions-checker = 1.8
coverage = 3.7.1
flake8 = 2.3.0
futures = 2.2.0
mccabe = 0.3
nose = 1.3.4
nose-progressive = 1.5.1
packaging = 15.0
pbp.recipe.noserunner = 0.2.6
pep8 = 1.6.2
pyflakes = 0.8.1
python-coveralls = 2.5.0
pyyaml = 3.11
requests = 2.5.3
sh = 1.11
six = 1.9.0
zc.buildout = 2.3.1
zc.recipe.egg = 2.0.1
2 changes: 1 addition & 1 deletion easy_extract/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""easy_extract module"""
__version__ = '0.1.2.dev'
__version__ = '0.1.2'
__license__ = 'GPL'

__author__ = 'Fantomas42'
Expand Down
Loading

0 comments on commit 3569224

Please sign in to comment.