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

Refactor Parser into Loader #35

Merged
merged 1 commit into from
Aug 25, 2016
Merged

Refactor Parser into Loader #35

merged 1 commit into from
Aug 25, 2016

Conversation

mayfield
Copy link
Contributor

  • Parser.parse -> Loader.load
  • Parser._parse ->Loader._load`
  • Use pytz.open_resource for zone file loading to fix pytz installs
    using shared zoneinfo files.
  • Fix for python2 setup and test (backport FileNotFoundError name).

Tested on Fedora Core 24 (linux), python2.7 (distro), python3.5
(distro)

Fixes #34

* `Parser.parse` -> `Loader.load`
* `Parser._parse -> `Loader._load`
* Use `pytz.open_resource` for zone file loading to fix pytz installs
  using shared zoneinfo files.
* Fix for python2 setup and test (backport `FileNotFoundError` name).

Tested on Fedora Core 24 (linux), python2.7 (distro), python3.5
(distro)

Fixes sdispater#34
@sdispater
Copy link
Owner

Thanks. Looks clean :-)

Just a quick question though: why did you put

try:
    FileNotFoundError
except NameError:
    FileNotFoundError = IOError  # py2k

in setup.py?

I just tested without and it works fine, but I'm on OSX so there might be some issues on Linux systems that require this.

@mayfield
Copy link
Contributor Author

FileNotFoundError is only available on python3. Actually only on 3.3+ I think. How it would be available otherwise is beyond me. Here is output from my osx box...

:; python
Python 2.7.12 (default, Jul 30 2016, 08:56:53) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> FileNotFoundError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'FileNotFoundError' is not defined

Same error. I ran into this when doing python ./setup.py test from linux btw.

@sdispater
Copy link
Owner

I didn't know and I was not getting the error because I'm not using python setup.py test but I directly invoke py.test 

@sdispater sdispater merged commit 850ff4c into sdispater:master Aug 25, 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.

Loader.load portability broken for some pytz installs
2 participants