Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issues with dateutil and pytz #983

Merged
merged 1 commit into from

3 participants

Christoph Gohlke Phil Elson Michael Droettboom
Christoph Gohlke

1) pytz is outdated. The latest version is 2012c http://pypi.python.org/pypi/pytz/2012c
2) pytz 2012c is compatible with Python 3 and should not be converted with the 2to3 tool.
3) dateutil 1.5 is for Python 2.x only. Dateutil 2.1 is for Python 3.x only. See http://labix.org/python-dateutil/.
4) dateutil 2.1 should should not be converted with the 2to3 tool.

How about the following fix (works for me on win-amd64-py3.2)?

1) update pytz to version 2012c
2) include dateutil 2.1 under lib/dateutil2
3) add lib/six.py
4) fix setup.py to use lib/dateutil2 instead of lib/dateutil on Python 3 and exclude pytz, dateutil2, and six.py from 2to3.

diff --git a/setup.py b/setup.py
index 6c59b4c..2fc64ff 100644
--- a/setup.py
+++ b/setup.py
@@ -106,6 +106,7 @@ package_data = {'matplotlib':['mpl-data/fonts/afm/*.afm',
                               'mpl-data/*.glade',
                               'backends/Matplotlib.nib/*',
                               ]}
+package_dir = {'': 'lib'}

 if 0:
     # TODO: exclude these when making release?
@@ -214,6 +215,8 @@ if hasdatetime: # dates require python23 datetime
         packages.append('dateutil')
         packages.append('dateutil.zoneinfo')
         package_data['dateutil'] = ['zoneinfo/zoneinfo*.tar.*']
+        if sys.version_info[0] >= 3:
+            py_modules.append('six')
+            package_dir['dateutil'] = 'lib/dateutil2'

     if sys.platform=='win32':
         # always add these to the win32 installer
@@ -275,7 +278,9 @@ if sys.version_info[0] >= 3:
         def run_2to3(self, files):
             # We need to skip certain files that have already been
             # converted to Python 3.x
-            filtered = [x for x in files if 'py3' not in x]
+            filtered = [x for x in files if ('py3' not in x and
+                                             'dateutil' not in x and
+                                             'pytz' not in x and
+                                             'six.py' not in x)]
             if sys.platform.startswith('win'):
                 # doing this in parallel on windows may crash your computer
                 [refactor(f) for f in filtered]
@@ -305,7 +310,7 @@ distrib = setup(name="matplotlib",
       platforms='any',
       py_modules = py_modules,
       ext_modules = ext_modules,
-      package_dir = {'': 'lib'},
+      package_dir = package_dir,
       package_data = package_data,
       cmdclass = {'build_py': build_py},
       **additional_params
Christoph Gohlke

Dateutil 2.1 depends on the module six.

Phil Elson
Collaborator

@cgohlke: What are the impacts of us not doing this for 1.2.x?

Michael Droettboom
Owner

I would like to get this in for 1.2. It doesn't have to be by the freeze tomorrow, as it isn't really a "new feature" as much as updating these libraries -- and the potential breakage that entails.

Christoph Gohlke

@pelson: We will have to exclude pytz and dateutil from the binary installers for Python 3 (Windows and Mac) and tell users to install them (and six.py) separately. That might be better anyway. It has always been problematic to include (outdated) pytz and dateutil packages that potentially overwrite existing packages in site-packages.

Michael Droettboom
Owner

@cgohlke: Yes -- I would like to move away from including dependencies as much as possible in the future as well. But I think for this release we should continue to do so to avoid surprises, and then perhaps for the next release remove most of these things from our own distribution. pip and friends work much better now than they did when all this was originally put in place.

Michael Droettboom mdboom Update pytz to 2012d and update dateutil to 1.5 for Python 2.x and 2.…
…1 for Python 3.x

Update setup.py so that it assume datetime is always there (as it should be on the versions of Python we support).

Update setup.py to not 2to3 pytz.

Update setup.py to install the correct version of dateutil that matches the version of Python.
07d8416
Michael Droettboom
Owner

I have attached a PR to make these updates and fix the 2to3 issues. Let me know how this works, and I am particularly curious to see how this addresses #745.

Michael Droettboom mdboom merged commit 354721b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 22, 2012
  1. Michael Droettboom

    Update pytz to 2012d and update dateutil to 1.5 for Python 2.x and 2.…

    mdboom authored
    …1 for Python 3.x
    
    Update setup.py so that it assume datetime is always there (as it should be on the versions of Python we support).
    
    Update setup.py to not 2to3 pytz.
    
    Update setup.py to install the correct version of dateutil that matches the version of Python.
Something went wrong with that request. Please try again.