Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yapremisrw2, yet another PREMIS reader/writer plugin #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,30 @@
from codecs import open
from os import path

from metsrw import __version__

here = path.abspath(path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You haven't renamed the global yet right? Is still reads here.

long_description = f.read()


def get_version():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also done in archivematica-fpr-admin. It looks a bit different - which method you prefer?

Copy link
Contributor Author

@jrwdunham jrwdunham Nov 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think raising a RuntimeError if no version retrievable is probably a good idea, as is allowing for UTF-8-encoded README and init.py files. Also, the regular expression approach is shorter. I'll copy that code to here.

version = '0.1.0'
with open(path.join(HERE, 'metsrw', '__init__.py')) as fi:
for line in fi:
if line.startswith('__version__'):
parts = line.strip().split()
try:
version = parts[2].replace("'", '').replace('"', '').strip()
except (IndexError, AttributeError):
continue
return version


setup(
name='metsrw',
version=__version__,
version=get_version(),

description='Library for dealing with METS files.',
long_description=long_description,
Expand Down