Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ruebot committed Nov 13, 2018
1 parent b95cda1 commit 39f71c6
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

A simple Python module for validating [BagIt](https://tools.ietf.org/html/rfc8493) profiles. See the [BagIt Profiles Specification (draft)](https://github.com/bagit-profiles/bagit-profiles/blob/master/README.md) for more information.

This module is intended for use with [bagit](https://github.com/edsu/bagit) but does not extend it.
This module is intended for use with [bagit-python](https://github.com/LibraryOfCongress/bagit-python) but does not extend it.

### Installation

`bagit_profile.py` is a single-file Python module that you can drop into your project as needed or you can install globally with:

1. `git clone https://github.com/bagit-profiles/bagit-profiles-validator.git`
2. `cd bagit-profiles/python`
2. `cd bagit-profiles-validator`
3. `sudo python setup.py install`

or:
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ Description

A simple Python module for validating BagIt profiles. See the `BagIt
Profiles Specification
<https://github.com/ruebot/bagit-profiles/blob/master/README.md>`__
<https://github.com/bagit-profiles/bagit-profiles/blob/master/README.md>`__
for more information.

This module is intended for use with
`bagit <https://github.com/edsu/bagit>`__ but does not extend it.
`bagit-python <https://github.com/LibraryOfCongress/bagit-python>`__ but does not extend it.

Installation
~~~~~~~~~~~~

bagit\_profile.py is a single-file python module that you can drop into
``bagit_profile.py`` is a single-file python module that you can drop into
your project as needed or you can install globally with:

1. ``git clone https://github.com/ruebot/bagit-profiles-validator.git``
2. ``cd bagit-profiles/python``
1. ``git clone https://github.com/bagit-profiles/bagit-profiles-validator.git``
2. ``cd bagit-profiles-validator``
3. ``sudo python setup.py install``

or:
Expand All @@ -41,7 +41,7 @@ Usage
import bagit_profile
Instantiate an existing Bag using
`bagit <https://github.com/edsu/bagit>`__.
`bagit <https://github.com/LibraryOfCongress/bagit-python>`__.
``python bag = bagit.Bag('mydir')``

Instantiate a profile, supplying its URI.
Expand Down
3 changes: 2 additions & 1 deletion bagit_profile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python

"""
A simple Python module for validating BagIt profiles. See https://github.com/ruebot/bagit-profiles
A simple Python module for validating BagIt profiles. See
https://github.com/bagit-profiles/bagit-profiles
for more information.
This module is intended for use with https://github.com/edsu/bagit but does not extend it.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
6 changes: 3 additions & 3 deletions module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import bagit_profile

# Instantiate an existing Bag using https://github.com/edsu/bagit.
bag = bagit.Bag('test-bar')
bag = bagit.Bag('fixtures/test-bar')

# Instantiate a profile, supplying its URI.
my_profile = bagit_profile.Profile('https://raw.github.com/ruebot/bagit-profiles/master/bagProfileBar.json')
my_profile = bagit_profile.Profile('https://raw.github.com/bagit-profiles/bagit-profiles/master/bagProfileBar.json')

# Validate 'Serialization' and 'Accept-Serialization'. This must be done
# before .validate(bag) is called. 'mydir' is the path to the Bag.
if my_profile.validate_serialization('test-bar'):
if my_profile.validate_serialization('fixtures/test-bar'):
print("Serialization validates")
else:
print("Serialization does not validate")
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"""
setup(
name = 'bagit_profile',
version = '1.1.1',
url = 'https://github.com/ruebot/bagit-profiles-validator',
version = '1.2.0',
url = 'https://github.com/bagit-profiles/bagit-profiles-validator',
install_requires=['bagit', 'requests'],
author = 'Mark Jordan, Nick Ruest',
author_email = '[email protected], [email protected]',
Expand All @@ -26,5 +26,10 @@
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Filesystems',
'Topic :: Utilities',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
8 changes: 4 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class BagitProfileConstructorTest(TestCase):

def setUp(self):
with open('./bagProfileBar.json', 'rb') as f:
with open('./fixtures/bagProfileBar.json', 'rb') as f:
self.profile_str = f.read().decode('utf-8') if sys.version_info > (3,) else f.read()
self.profile_dict = json.loads(self.profile_str)

Expand All @@ -25,7 +25,7 @@ def test_profile_kwarg(self):
class Test_bag_profile(TestCase):

def setUp(self):
self.bag = bagit.Bag('test-bar')
self.bag = bagit.Bag('fixtures/test-bar')
self.profile = Profile(PROFILE_URL)
self.retrieved_profile = self.profile.get_profile()

Expand All @@ -49,10 +49,10 @@ def test_validate_accept_bagit_version(self):

def test_validate_serialization(self):
# Test on unzipped Bag.
self.assertTrue(self.profile.validate_serialization(os.path.abspath("test-bar")))
self.assertTrue(self.profile.validate_serialization(os.path.abspath("fixtures/test-bar")))
# Test on zipped Bag.
self.profile = Profile(PROFILE_URL)
self.assertTrue(self.profile.validate_serialization(os.path.abspath("test-foo.zip")))
self.assertTrue(self.profile.validate_serialization(os.path.abspath("fixtures/test-foo.zip")))

if __name__ == '__main__':
main()

0 comments on commit 39f71c6

Please sign in to comment.