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
Read README as utf-8 text and set the content_type to text/markdown #26
Conversation
setup.py
Outdated
try: | ||
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: | ||
long_description = '\n' + f.read() | ||
except FileNotFoundError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception was introduced in Python 3.something. Sadly it doesn't work on py2.
setup.py
Outdated
try: | ||
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: | ||
long_description = '\n' + f.read() | ||
except IOError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure we should be catching that exception. It should always exist and otherwise it's an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will update.
setup.py
Outdated
here = os.path.abspath(os.path.dirname(__file__)) | ||
try: | ||
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: | ||
long_description = '\n' + f.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why start with a newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just looks nicer in the *.dist-info/METADATA
file in the wheel package.
setup.py
Outdated
# Import the README and use it as the long-description. | ||
# This requires 'README.md' to be present in MANIFEST.in. | ||
here = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encoding is not a valid parameter on python 2. It's better to use io.open
which should already be present on python 2.7.
Could you rebase on master and see if it fixes the tests on travis with 3.4? |
This requires an up-to-date setuptools; older versions will complain about it (without crashing).
7b69465
to
cc00ff2
Compare
No luck with AppVeyor or Travis... any suggestions? |
This is an improvement on #24 and fixes #17.
The generated wheel file contains the correct content_type and 'README' content.