[Python-modules-commits] [purl] 01/06: Import purl_1.3.orig.tar.gz
Michael Fladischer
fladi at moszumanska.debian.org
Wed May 4 08:04:45 UTC 2016
This is an automated email from the git hooks/post-receive script.
fladi pushed a commit to branch master
in repository purl.
commit ff72d8710e758677566e206e983d70a2abcea0f9
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date: Wed May 4 09:42:07 2016 +0200
Import purl_1.3.orig.tar.gz
---
PKG-INFO | 7 ++++++-
README.rst | 5 +++++
purl.egg-info/PKG-INFO | 7 ++++++-
purl/__init__.py | 2 +-
purl/url.py | 17 +++++++++++++++--
setup.py | 13 +------------
6 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 40bece1..1fd342d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: purl
-Version: 1.2
+Version: 1.3
Summary: An immutable URL class for easy URL-building and manipulation
Home-page: https://github.com/codeinthehole/purl
Author: David Winterbottom
@@ -176,6 +176,11 @@ Description: ================================
Changelog
---------
+ v1.3
+ ~~~~
+
+ * Allow absolute URLs to be converted into relative
+
v1.2
~~~~
diff --git a/README.rst b/README.rst
index c1cdbe7..70edbda 100644
--- a/README.rst
+++ b/README.rst
@@ -168,6 +168,11 @@ A wide variety of expansions are possible - refer to the RFC_ for more details.
Changelog
---------
+v1.3
+~~~~
+
+* Allow absolute URLs to be converted into relative
+
v1.2
~~~~
diff --git a/purl.egg-info/PKG-INFO b/purl.egg-info/PKG-INFO
index 40bece1..1fd342d 100644
--- a/purl.egg-info/PKG-INFO
+++ b/purl.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: purl
-Version: 1.2
+Version: 1.3
Summary: An immutable URL class for easy URL-building and manipulation
Home-page: https://github.com/codeinthehole/purl
Author: David Winterbottom
@@ -176,6 +176,11 @@ Description: ================================
Changelog
---------
+ v1.3
+ ~~~~
+
+ * Allow absolute URLs to be converted into relative
+
v1.2
~~~~
diff --git a/purl/__init__.py b/purl/__init__.py
index f3d0b6d..2610b4a 100644
--- a/purl/__init__.py
+++ b/purl/__init__.py
@@ -1,4 +1,4 @@
from .url import URL # noqa
from .template import expand, Template # noqa
-__version__ = '1.2'
+__all__ = ['URL', 'expand', 'Template']
diff --git a/purl/url.py b/purl/url.py
index 0dcc13b..b81e056 100644
--- a/purl/url.py
+++ b/purl/url.py
@@ -204,7 +204,7 @@ class URL(object):
url.path,
'?%s' % url.query if url.query else '',
'#%s' % url.fragment if url.fragment else '']
- if url.host is None:
+ if not url.host:
return ''.join(parts[2:])
return ''.join(parts)
@@ -235,7 +235,7 @@ class URL(object):
:param string value: new host string
"""
- if value:
+ if value is not None:
return URL._mutate(self, host=value)
return self._tuple.host
@@ -348,6 +348,15 @@ class URL(object):
return URL._mutate(self, fragment=value)
return unicode_unquote(self._tuple.fragment)
+ def relative(self):
+ """
+ Return a relative URL object (eg strip the protocol and host)
+
+ :returns: new :class:`URL` instance
+ """
+ return URL._mutate(self, scheme=None, host=None)
+
+
# ====
# Path
# ====
@@ -501,6 +510,10 @@ class URL(object):
del parse_result[key]
return URL._mutate(self, query=unicode_urlencode(parse_result, doseq=True))
+ # =======
+ # Helpers
+ # =======
+
@classmethod
def _mutate(cls, url, **kwargs):
args = url._tuple._asdict()
diff --git a/setup.py b/setup.py
index e063516..85433e7 100755
--- a/setup.py
+++ b/setup.py
@@ -1,20 +1,9 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
-import sys
-
-from purl import __version__
-
-# Python 2/3 compatibility
-if sys.version_info[0] == 3:
- def as_bytes(s):
- return s
-else:
- def as_bytes(s):
- return s.encode('utf8')
setup(
name='purl',
- version=as_bytes(__version__),
+ version='1.3',
description=(
"An immutable URL class for easy URL-building and manipulation"),
long_description=open('README.rst').read(),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/purl.git
More information about the Python-modules-commits
mailing list