Skip to content

Commit

Permalink
Merge 11ce967 into f023804
Browse files Browse the repository at this point in the history
  • Loading branch information
lnielsen committed Oct 30, 2015
2 parents f023804 + 11ce967 commit eccde38
Show file tree
Hide file tree
Showing 17 changed files with 398 additions and 60 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,14 @@ script:

after_success:
- coveralls

deploy:
provider: pypi
user: lnielsen
password:
secure: 2bglYX1uhxqMFyMTIU0WwrLoOQOWyPFzBsEr1ya6JMVozP49O0ls1X4Frh1VuXUqOJqppr2wOGkUJUgpE5K79nsXmEU3HbaPC7vhIwCIo0ilVYJ+hGGmX9tLYGQVlTAMECOXbxKz29omglAAFLY0V14nX0mCyyMoa90Q5MKXRO3A7cYiGMRoRwwVVGcz409TvALvekdRDlSp3mmseyjBrvMIIf+tUW7Cou9VqKE4f4XmziMpjurdFlCL6WfW4XAOJBZ8ww8I3ypjKmm+Q6Rj8pcXhwF19FKl53VYwYgKtVwIace/krpEAgTJ4bYY9LEggA7xyIOeec8u7P2/J7EX2/XvHqeTlHh7nA5MKsfglpk9F6YJwMn6VPHHI2G9yr8v+Rfql/kxqPxeEKMHH5/crTn8X/V0uL3TPbi270YCAS6LduE+5RHHrece2TeiVlbZXppLpmCT8OGPraAzeIWxqThE1LOocLWSw/CJsZ5ZJqyNBC/yc2TQ4h2oWv3Pk1+9k6tDtId0AQa2QvY5OBwPeh8BL8rIilFt1UMGNnTKNgGiL22iEKvXcnLPrtEx+rOqH0emMLNVRV0dqU1SThcIYIhPVAexRy/Xw179E+LjCqwbBzMFOGU60ldM/2bt7bzzFjWgcL5p7IU1vtAD0rKeRzEauPWfIZrMSq3XSEzZfEI=
distributions: "sdist bdist_wheel"
on:
tags: true
python: "2.7"
condition: $REQUIREMENTS = release
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
Changes
=======

Version 1.0.0 (released 2015-10-30)
-----------------------------------

Version 0.1.3 (released 2015-10-11)
-----------------------------------

Expand Down
8 changes: 4 additions & 4 deletions RELEASE-NOTES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=========================
Invenio-PIDStore v0.1.3
Invenio-PIDStore v1.0.0
=========================

Invenio-PIDStore v0.1.3 was released on October 11, 2015.
Invenio-PIDStore v1.0.0 was released on October 30, 2015.

About
-----
Expand All @@ -19,12 +19,12 @@ Improved features
Installation
------------

$ pip install invenio-pidstore==0.1.3
$ pip install invenio-pidstore==1.0.0

Documentation
-------------

http://invenio-pidstore.readthedocs.org/en/v0.1.3
http://pythonhosted.org/invenio-pidstore/

Happy hacking and thanks for flying Invenio-PIDStore.

Expand Down
27 changes: 16 additions & 11 deletions invenio_pidstore/config.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,49 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Pidstore config."""

from __future__ import unicode_literals
from __future__ import absolute_import, print_function

import pkg_resources

PIDSTORE_PROVIDERS = [
'invenio_pidstore.providers.recordid:RecordID',
'invenio_pidstore.providers.local_doi:LocalDOI',
]

EXTRA_PIDSTORE_PROVIDERS = [
('datacite', 'invenio_pidstore.providers.datacite:DataCite', ),
('invenio_records', 'invenio_records.providers.recid:RecordID', ),
]

for dependency, provider in EXTRA_PIDSTORE_PROVIDERS:
try:
pkg_resources.get_distribution(dependency)
except pkg_resources.DistributionNotFound:
import warnings
warnings.warn("Dependency {0} is required to provider {1}".format(
dependency, provider.split(":")[-1]))
warnings.warn("Dependency {0} is required for provider {1}".format(
dependency, provider.split(":")[-1]), ImportWarning)
else:
PIDSTORE_PROVIDERS.append(provider)

Expand Down
55 changes: 55 additions & 0 deletions invenio_pidstore/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Errors for persistent identifiers."""


class ResolverError(Exception):
"""Base class for resolver errors."""

def __init__(self, pid_type, pid_value, *args, **kwargs):
"""Initialize exception."""
self.pid_value = pid_type
self.pid_value = pid_value
super(ResolverError, self).__init__(*args, **kwargs)


class PIDDoesNotExistsError(ResolverError):
"""Persistent identifier does not exists."""


class PIDDeletedError(ResolverError):
"""Persistent identifier is deleted."""


class PIDMissingObjectError(ResolverError):
"""Persistent identifier has no object."""


class PIDUnregistered(ResolverError):
"""Persistent identifier is not registered."""


class PIDMergedError(ResolverError):
"""Persistent identifier is merged into another."""
21 changes: 14 additions & 7 deletions invenio_pidstore/models.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""PersistentIdentifier store and registration.
Expand Down Expand Up @@ -52,6 +57,8 @@
pid.delete()
"""

from __future__ import absolute_import, print_function

from datetime import datetime

import six
Expand Down
23 changes: 15 additions & 8 deletions invenio_pidstore/provider.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Define APIs for PID providers."""

from __future__ import absolute_import, print_function

from .registry import pidproviders


Expand Down
17 changes: 11 additions & 6 deletions invenio_pidstore/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Module storing implementations of PID providers."""
19 changes: 12 additions & 7 deletions invenio_pidstore/providers/datacite.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""DataCite PID provider."""

Expand Down
19 changes: 12 additions & 7 deletions invenio_pidstore/providers/local_doi.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Define provider for locally unmanaged DOIs."""

Expand Down
40 changes: 40 additions & 0 deletions invenio_pidstore/providers/recordid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Record ID provider."""

from __future__ import absolute_import, print_function

from ..provider import LocalPidProvider


class RecordID(LocalPidProvider):
"""Provider for recids."""

pid_type = 'recid'

@classmethod
def is_provider_for_pid(cls, pid_str):
"""Check if RecordID is a provider for ``pid_str``."""
return isinstance(pid_str, int) or pid_str.isdigit()
Loading

0 comments on commit eccde38

Please sign in to comment.