Update to 2.4
This commit is contained in:
parent
b612e52404
commit
58e0ca4060
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
python-dateutil-1.4.1.tar.gz
|
python-dateutil-1.4.1.tar.gz
|
||||||
/python-dateutil-1.5.tar.gz
|
/python-dateutil-1.5.tar.gz
|
||||||
/python-dateutil-2.2.tar.gz
|
/python-dateutil-2.2.tar.gz
|
||||||
|
/2.4.0.tar.gz
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
diff -up python-dateutil-1.5/dateutil/zoneinfo/__init__.py\~ python-dateutil-1.5/dateutil/zoneinfo/__init__.py
|
|
||||||
--- python-dateutil-1.5/dateutil/zoneinfo/__init__.py~ 2005-12-22 19:13:50.000000000 +0100
|
|
||||||
+++ python-dateutil-1.5/dateutil/zoneinfo/__init__.py 2011-08-17 15:24:29.019214748 +0200
|
|
||||||
@@ -15,6 +15,7 @@ __all__ = ["setcachesize", "gettz", "reb
|
|
||||||
|
|
||||||
CACHE = []
|
|
||||||
CACHESIZE = 10
|
|
||||||
+USE_SYSTEM_ZONEINFO = True # XXX configure at build time
|
|
||||||
|
|
||||||
class tzfile(tzfile):
|
|
||||||
def __reduce__(self):
|
|
||||||
@@ -29,7 +30,8 @@ def getzoneinfofile():
|
|
||||||
return os.path.join(os.path.dirname(__file__), entry)
|
|
||||||
return None
|
|
||||||
|
|
||||||
-ZONEINFOFILE = getzoneinfofile()
|
|
||||||
+ZONEINFOFILE = getzoneinfofile() if USE_SYSTEM_ZONEINFO else None
|
|
||||||
+ZONEINFODIR = (os.getenv("TZDIR") or "/usr/share/zoneinfo").rstrip(os.sep)
|
|
||||||
|
|
||||||
del getzoneinfofile
|
|
||||||
|
|
||||||
@@ -39,22 +40,37 @@ def setcachesize(size):
|
|
||||||
del CACHE[size:]
|
|
||||||
|
|
||||||
def gettz(name):
|
|
||||||
- tzinfo = None
|
|
||||||
- if ZONEINFOFILE:
|
|
||||||
- for cachedname, tzinfo in CACHE:
|
|
||||||
- if cachedname == name:
|
|
||||||
- break
|
|
||||||
+ for cachedname, tzinfo in CACHE:
|
|
||||||
+ if cachedname == name:
|
|
||||||
+ return tzinfo
|
|
||||||
+
|
|
||||||
+ name_parts = name.lstrip('/').split('/')
|
|
||||||
+ for part in name_parts:
|
|
||||||
+ if part == os.path.pardir or os.path.sep in part:
|
|
||||||
+ raise ValueError('Bad path segment: %r' % part)
|
|
||||||
+ filename = os.path.join(ZONEINFODIR, *name_parts)
|
|
||||||
+ try:
|
|
||||||
+ zonefile = open(filename, "rb")
|
|
||||||
+ except:
|
|
||||||
+ tzinfo = None
|
|
||||||
+ else:
|
|
||||||
+ tzinfo = tzfile(zonefile)
|
|
||||||
+ zonefile.close()
|
|
||||||
+
|
|
||||||
+ if tzinfo is None and ZONEINFOFILE:
|
|
||||||
+ tf = TarFile.open(ZONEINFOFILE)
|
|
||||||
+ try:
|
|
||||||
+ zonefile = tf.extractfile(name)
|
|
||||||
+ except KeyError:
|
|
||||||
+ tzinfo = None
|
|
||||||
else:
|
|
||||||
- tf = TarFile.open(ZONEINFOFILE)
|
|
||||||
- try:
|
|
||||||
- zonefile = tf.extractfile(name)
|
|
||||||
- except KeyError:
|
|
||||||
- tzinfo = None
|
|
||||||
- else:
|
|
||||||
- tzinfo = tzfile(zonefile)
|
|
||||||
- tf.close()
|
|
||||||
- CACHE.insert(0, (name, tzinfo))
|
|
||||||
- del CACHE[CACHESIZE:]
|
|
||||||
+ tzinfo = tzfile(zonefile)
|
|
||||||
+ tf.close()
|
|
||||||
+
|
|
||||||
+ if tzinfo is not None:
|
|
||||||
+ CACHE.insert(0, (name, tzinfo))
|
|
||||||
+ del CACHE[CACHESIZE:]
|
|
||||||
+
|
|
||||||
return tzinfo
|
|
||||||
|
|
||||||
def rebuild(filename, tag=None, format="gz"):
|
|
||||||
diff -up python-dateutil-1.5/setup.py\~ python-dateutil-1.5/setup.py
|
|
||||||
--- python-dateutil-1.5/setup.py~ 2010-01-11 10:43:22.000000000 +0100
|
|
||||||
+++ python-dateutil-1.5/setup.py 2011-08-17 15:38:13.206304651 +0200
|
|
||||||
@@ -15,6 +15,16 @@ TOPDIR = os.path.dirname(__file__) or ".
|
|
||||||
VERSION = re.search('__version__ = "([^"]+)"',
|
|
||||||
open(TOPDIR + "/dateutil/__init__.py").read()).group(1)
|
|
||||||
|
|
||||||
+# XXX We would like to bind this to something like
|
|
||||||
+# --system-zoneinfo=/path/to/zoneinfo. Any way of doing this short of
|
|
||||||
+# overriding build and install commands?
|
|
||||||
+if False:
|
|
||||||
+ extra_options = dict(
|
|
||||||
+ package_data={"": ["*.tar.gz"]},
|
|
||||||
+ )
|
|
||||||
+else:
|
|
||||||
+ extra_options = {}
|
|
||||||
+
|
|
||||||
|
|
||||||
setup(name="python-dateutil",
|
|
||||||
version = VERSION,
|
|
||||||
@@ -29,7 +39,7 @@ The dateutil module provides powerful ex
|
|
||||||
datetime module, available in Python 2.3+.
|
|
||||||
""",
|
|
||||||
packages = ["dateutil", "dateutil.zoneinfo"],
|
|
||||||
- package_data={"": ["*.tar.gz"]},
|
|
||||||
include_package_data=True,
|
|
||||||
zip_safe=False,
|
|
||||||
+ **extra_options
|
|
||||||
)
|
|
50
python-dateutil-system-zoneinfo.patch
Normal file
50
python-dateutil-system-zoneinfo.patch
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
--- dateutil/zoneinfo/__init__.py
|
||||||
|
+++ dateutil/zoneinfo/__init__.py
|
||||||
|
@@ -14,9 +14,10 @@
|
||||||
|
|
||||||
|
__all__ = ["setcachesize", "gettz", "rebuild"]
|
||||||
|
|
||||||
|
-_ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
|
||||||
|
+_LOCAL_ZONEINFO_FILE = "dateutil-zoneinfo.tar.gz"
|
||||||
|
+_SYSTEM_ZONEINFO_DIR = "/usr/share/zoneinfo"
|
||||||
|
|
||||||
|
-# python2.6 compatability. Note that TarFile.__exit__ != TarFile.close, but
|
||||||
|
+# python2.6 compatibility. Note that TarFile.__exit__ != TarFile.close, but
|
||||||
|
# it's close enough for python2.6
|
||||||
|
_tar_open = TarFile.open
|
||||||
|
if not hasattr(TarFile, '__exit__'):
|
||||||
|
@@ -31,9 +32,8 @@
|
||||||
|
|
||||||
|
def getzoneinfofile_stream():
|
||||||
|
try:
|
||||||
|
- return BytesIO(get_data(__name__, _ZONEFILENAME))
|
||||||
|
+ return BytesIO(get_data(__name__, _LOCAL_ZONEINFO_FILE))
|
||||||
|
except IOError as e: # TODO switch to FileNotFoundError?
|
||||||
|
- warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@@ -59,6 +59,14 @@
|
||||||
|
self.zones.update(links)
|
||||||
|
else:
|
||||||
|
self.zones = dict()
|
||||||
|
+ if os.path.isdir(_SYSTEM_ZONEINFO_DIR):
|
||||||
|
+ for root, dirnames, filenames in os.walk(_SYSTEM_ZONEINFO_DIR):
|
||||||
|
+ for filename in filenames:
|
||||||
|
+ absolute_filename = os.path.join(root, filename)
|
||||||
|
+ relative_filename = absolute_filename[len(_SYSTEM_ZONEINFO_DIR)+1:]
|
||||||
|
+ with open(absolute_filename, "rb") as file:
|
||||||
|
+ if file.read(4) == b"TZif":
|
||||||
|
+ self.zones[relative_filename] = tzfile(absolute_filename, relative_filename)
|
||||||
|
|
||||||
|
|
||||||
|
# The current API has gettz as a module function, although in fact it taps into
|
||||||
|
@@ -99,7 +107,7 @@
|
||||||
|
"libc-bin or some other package that provides it, "
|
||||||
|
"or it's not in your PATH?")
|
||||||
|
raise
|
||||||
|
- target = os.path.join(moduledir, _ZONEFILENAME)
|
||||||
|
+ target = os.path.join(moduledir, _LOCAL_ZONEINFO_FILE)
|
||||||
|
with _tar_open(target, "w:%s" % format) as tf:
|
||||||
|
for entry in os.listdir(zonedir):
|
||||||
|
entrypath = os.path.join(zonedir, entry)
|
@ -1,42 +1,48 @@
|
|||||||
Name: python-dateutil
|
Name: python-dateutil
|
||||||
Version: 1.5
|
Version: 2.4.0
|
||||||
Release: 0%{?dist}
|
Release: 1%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: Powerful extensions to the standard datetime module
|
Summary: Powerful extensions to the standard datetime module
|
||||||
|
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
License: Python
|
License: Python
|
||||||
URL: http://labix.org/python-dateutil
|
URL: https://github.com/dateutil/dateutil
|
||||||
Source0: http://labix.org/download/%{name}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/dateutil/dateutil/archive/2.4.0.tar.gz
|
||||||
Patch0: python-dateutil-1.5-system-zoneinfo.patch
|
# https://github.com/dateutil/dateutil/issues/11
|
||||||
|
Patch0: python-dateutil-system-zoneinfo.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python-devel,python-setuptools
|
BuildRequires: python2-devel
|
||||||
Requires: tzdata
|
BuildRequires: python-setuptools
|
||||||
|
Requires: tzdata
|
||||||
|
Requires: python-six
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The dateutil module provides powerful extensions to the standard datetime
|
The dateutil module provides powerful extensions to the standard datetime
|
||||||
module available in Python 2.3+.
|
module available in Python 2.3+.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q -n dateutil-%{version}
|
||||||
%patch0 -p1
|
%patch0 -p0
|
||||||
|
|
||||||
iconv --from=ISO-8859-1 --to=UTF-8 NEWS > NEWS.new
|
iconv --from=ISO-8859-1 --to=UTF-8 NEWS > NEWS.new
|
||||||
mv NEWS.new NEWS
|
mv NEWS.new NEWS
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python2} setup.py build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc example.py LICENSE NEWS README
|
%license LICENSE
|
||||||
%{python_sitelib}/dateutil/
|
%doc NEWS README.rst
|
||||||
%exclude %{python_sitelib}/dateutil/zoneinfo/zoneinfo-2010g.tar.gz
|
%{python2_sitelib}/dateutil/
|
||||||
%{python_sitelib}/*.egg-info
|
%{python2_sitelib}/*.egg-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 21 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1:2.4.0-1
|
||||||
|
- Change to new upstream, update to 2.4 (#1126521)
|
||||||
|
|
||||||
* Tue Aug 05 2014 Jon Ciesla <limburgher@gmail.com> - 1:1.5-9
|
* Tue Aug 05 2014 Jon Ciesla <limburgher@gmail.com> - 1:1.5-9
|
||||||
- Reverting to 1.5 pre user feedback and upstream.
|
- Reverting to 1.5 pre user feedback and upstream.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user