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

Issues with dateutil and pytz #983

Merged
merged 1 commit into from Aug 22, 2012

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Aug 22, 2012

  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

@cgohlke
Copy link
Contributor Author

cgohlke commented Jul 29, 2012

Dateutil 2.1 depends on the module six.

@pelson
Copy link
Member

pelson commented Aug 19, 2012

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

@mdboom
Copy link
Member

mdboom commented Aug 19, 2012

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.

@cgohlke
Copy link
Contributor Author

cgohlke commented Aug 19, 2012

@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.

@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

@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.

…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.
@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

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.

mdboom added a commit that referenced this pull request Aug 22, 2012
@mdboom mdboom merged commit 354721b into matplotlib:master Aug 22, 2012
@mdboom mdboom deleted the update_pytz_and_dateutil branch March 3, 2015 18:44
@QuLogic QuLogic removed the status: needs clarification Issues that need more information to resolve. label Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants