Skip to content

Ensure that command line tools use LF line endings to work on Linux/OS X #17

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

Merged
merged 1 commit into from
Feb 2, 2016

Conversation

orangain
Copy link
Contributor

Problem

Command line tools, pdf2txt.py and dumppdf.py, does not work when installed via pip on Linux/OS X.

$ pip install pdfminer.six
Downloading/unpacking pdfminer.six
...
Successfully installed pdfminer.six six chardet
Cleaning up...
$ pdf2txt.py
env: python\r: No such file or directory
$ dumppdf.py
env: python\r: No such file or directory

This is because tools/pdf2txt.py and tools/dumppdf.py uploaded on the PyPI contain CRLF line endings. The line endings should be LF to work on Linux/OS X.

Note that installing by python setup.py install does not cause this issue because setuptools generates a wrapper script for pdf2txt.py and dumppdf.py which have LF line endings. However I believe PDFMiner.six should be installable via pip because pip is a de facto standard package manager in Python community today.

Changes

This PR add .gitattributes to ensure that *.py files are always checked out with LF line endings regardless of individual's git settings even on Windows. I believe the PR will fix the problem and prevent future regression. After adding .gitattributes, you may need to reset all files to get LF line endings by:

$ git rm --cached -r .
$ git reset --hard

See also:

Dealing with line endings - User Documentation
https://help.github.com/articles/dealing-with-line-endings/

goulu added a commit that referenced this pull request Feb 2, 2016
Ensure that command line tools use LF line endings to work on Linux/OS X
@goulu goulu merged commit 5f888fe into pdfminer:master Feb 2, 2016
@goulu
Copy link
Member

goulu commented Feb 2, 2016

Thanks a lot !

@orangain
Copy link
Contributor Author

orangain commented Feb 5, 2016

@goulu Thank you for merging. I tried to install the new version 20160202 on the PyPI and run pdf2txt.py, but I found that there still remains the same problem.

(venv) $ pip install pdfminer.six
Downloading/unpacking pdfminer.six
  Downloading pdfminer.six-20160202.zip (9.7MB): 9.7MB downloaded
  ...
Successfully installed pdfminer.six six chardet
Cleaning up...
(venv) $ pip freeze
chardet==2.3.0
pdfminer.six==20160202
six==1.10.0
(venv) $ pdf2txt.py
env: python\r: No such file or directory

Could you please make sure that *.py files have the LF line endings on your machine where you create the zip archive to be uploaded to the PyPI?

@jt-wang
Copy link

jt-wang commented Nov 2, 2016

This problem still happens with the latest version of pdfminer.six on pip today.

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.

3 participants