Skip to content

Commit

Permalink
Merge branch '1.0.x' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Oct 15, 2018
2 parents bdc6bf7 + 47e3c98 commit cf02ec1
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 35 deletions.
1 change: 1 addition & 0 deletions .travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ in
;;
checks)
flake8 --ignore=E731 reprozip/reprozip reprounzip/reprounzip reprounzip-*/reprounzip reprounzip-qt/reprounzip_qt reprozip-jupyter/reprozip_jupyter tests/*.py
find scripts -name '*.py' -exec flake8 {} +
diff -q reprozip/reprozip/common.py reprounzip/reprounzip/common.py
diff -q reprozip/reprozip/utils.py reprounzip/reprounzip/utils.py
find reprozip reprounzip reprozip-* reprounzip-* .travis -name '*.py' -or -name '*.sh' -or -name '*.h' -or -name '*.c' | (set +x; while read i; do
Expand Down
2 changes: 1 addition & 1 deletion docs/developerguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Writing Unpackers

ReproZip is divided into two steps. The first is packing, which gives a generic package containing the trace SQLite database, the YAML configuration file (which lists the paths, packages, and metadata such as command line, environment variables, and input/output files), and actual files. In the second step, a package can be run using *reprounzip*. This decoupling allows the reproducer to select the unpacker of his/her desire, and also means that when a new unpacker is released, users will be able to use it on their old packages.

Currently, different unpackers are maintained: the defaults ones (``directory`` and ``chroot``), ``vagrant`` (distributed as `reprounzip-vagrant <https://pypi.org/project/reprounzip-vagrant>`__) and ``docker`` (distributed as `reprounzip-docker <https://pypi.org/project/reprounzip-docker>`__). However, the interface is such that new unpackers can be easily added. While taking a look at the "official" unpackers' source is probably a good idea, this page gives some useful information about how they work.
Currently, different unpackers are maintained: the defaults ones (``directory`` and ``chroot``), ``vagrant`` (distributed as `reprounzip-vagrant <https://pypi.org/project/reprounzip-vagrant/>`__) and ``docker`` (distributed as `reprounzip-docker <https://pypi.org/project/reprounzip-docker/>`__). However, the interface is such that new unpackers can be easily added. While taking a look at the "official" unpackers' source is probably a good idea, this page gives some useful information about how they work.

ReproZip Pack Format (``.rpz``)
'''''''''''''''''''''''''''''''
Expand Down
2 changes: 2 additions & 0 deletions reprounzip-docker/reprounzip/unpackers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ def docker_setup_build(args):

if args.image_name:
image = args.image_name[0]
if not isinstance(image, bytes):
image = image.encode('ascii')
else:
image = make_unique_name(b'reprounzip_image_')

Expand Down
2 changes: 2 additions & 0 deletions reprounzip-vistrails/reprounzip/plugins/vistrails.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,5 @@ def cmd(lst, add=None):
output_name, filename = output_file.split(':', 1)
cmd(['download', '.',
'%s:%s' % (output_name, filename)])

sys.exit(0)
18 changes: 14 additions & 4 deletions reprounzip/reprounzip/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
import yaml

from .utils import iteritems, itervalues, unicode_, stderr, UniqueNames, \
escape, CommonEqualityMixin, optional_return_type, isodatetime, hsize, \
join_root, copyfile
escape, optional_return_type, isodatetime, hsize, join_root, copyfile


logger = logging.getLogger(__name__.split('.', 1)[0])
Expand All @@ -51,7 +50,7 @@
FILE_LINK = 0x10


class File(CommonEqualityMixin):
class File(object):
"""A file, used at some point during the experiment.
"""
comment = None
Expand All @@ -64,11 +63,14 @@ def __eq__(self, other):
return (isinstance(other, File) and
self.path == other.path)

def __ne__(self, other):
return not self.__eq__(other)

def __hash__(self):
return hash(self.path)


class Package(CommonEqualityMixin):
class Package(object):
"""A distribution package, containing a set of files.
"""
def __init__(self, name, version, files=None, packfiles=True, size=None,
Expand All @@ -80,6 +82,14 @@ def __init__(self, name, version, files=None, packfiles=True, size=None,
self.size = size
self.meta = meta or {}

def __eq__(self, other):
return (isinstance(other, Package) and
self.name == other.name and
self.version == other.version)

def __ne__(self, other):
return not self.__eq__(other)

def add_file(self, file_):
self.files.append(file_)

Expand Down
11 changes: 0 additions & 11 deletions reprounzip/reprounzip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,6 @@ def escape(s):
return s.replace('\\', '\\\\').replace('"', '\\"')


class CommonEqualityMixin(object):
"""Common mixin providing comparison by comparing ``__dict__`` attributes.
"""
def __eq__(self, other):
return (isinstance(other, self.__class__) and
self.__dict__ == other.__dict__)

def __ne__(self, other):
return not self.__eq__(other)


def optional_return_type(req_args, other_args):
"""Sort of namedtuple but with name-only fields.
Expand Down
4 changes: 4 additions & 0 deletions reprozip-jupyter/reprozip_jupyter/server_extension.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (C) 2014-2017 New York University
# This file is part of ReproZip which is released under the Revised BSD License
# See file LICENSE for full license details.

from datetime import datetime
from notebook.utils import url_path_join as ujoin
from rpaths import Path
Expand Down
18 changes: 14 additions & 4 deletions reprozip/reprozip/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
import yaml

from .utils import iteritems, itervalues, unicode_, stderr, UniqueNames, \
escape, CommonEqualityMixin, optional_return_type, isodatetime, hsize, \
join_root, copyfile
escape, optional_return_type, isodatetime, hsize, join_root, copyfile


logger = logging.getLogger(__name__.split('.', 1)[0])
Expand All @@ -51,7 +50,7 @@
FILE_LINK = 0x10


class File(CommonEqualityMixin):
class File(object):
"""A file, used at some point during the experiment.
"""
comment = None
Expand All @@ -64,11 +63,14 @@ def __eq__(self, other):
return (isinstance(other, File) and
self.path == other.path)

def __ne__(self, other):
return not self.__eq__(other)

def __hash__(self):
return hash(self.path)


class Package(CommonEqualityMixin):
class Package(object):
"""A distribution package, containing a set of files.
"""
def __init__(self, name, version, files=None, packfiles=True, size=None,
Expand All @@ -80,6 +82,14 @@ def __init__(self, name, version, files=None, packfiles=True, size=None,
self.size = size
self.meta = meta or {}

def __eq__(self, other):
return (isinstance(other, Package) and
self.name == other.name and
self.version == other.version)

def __ne__(self, other):
return not self.__eq__(other)

def add_file(self, file_):
self.files.append(file_)

Expand Down
11 changes: 0 additions & 11 deletions reprozip/reprozip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,6 @@ def escape(s):
return s.replace('\\', '\\\\').replace('"', '\\"')


class CommonEqualityMixin(object):
"""Common mixin providing comparison by comparing ``__dict__`` attributes.
"""
def __eq__(self, other):
return (isinstance(other, self.__class__) and
self.__dict__ == other.__dict__)

def __ne__(self, other):
return not self.__eq__(other)


def optional_return_type(req_args, other_args):
"""Sort of namedtuple but with name-only fields.
Expand Down
1 change: 0 additions & 1 deletion scripts/conda/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from os.path import join
import re
import shutil
import struct
import subprocess
import sys
import tempfile
Expand Down
6 changes: 3 additions & 3 deletions scripts/test_bug_23058.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def test_parents(self):

subparsers = parser.add_subparsers()

command = subparsers.add_parser('command', parents=[options])
subparsers.add_parser('command', parents=[options])

self.do_test_verbosity(parser, 'command', 1)
self.do_test_verbosity(parser, 'command -v', 2)
self.do_test_verbosity(parser, 'command -v -v', 3)
self.do_test_verbosity(parser, '-v command', 2) # FAILS
# arguments passed to main parser are *silently ignored*
# arguments passed to main parser are *silently ignored*
self.do_test_verbosity(parser, '-v -v command', 3)
self.do_test_verbosity(parser, '-v -v command -v -v', 5)

Expand All @@ -48,7 +48,7 @@ def add_options(prs):
self.do_test_verbosity(parser, 'command -v', 2)
self.do_test_verbosity(parser, 'command -v -v', 3)
self.do_test_verbosity(parser, '-v command', 2) # FAILS
# arguments passed to main parser are *silently ignored*
# arguments passed to main parser are *silently ignored*
self.do_test_verbosity(parser, '-v -v command', 3)
self.do_test_verbosity(parser, '-v -v command -v -v', 5)

Expand Down

0 comments on commit cf02ec1

Please sign in to comment.