This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: translate Windows newlines when installing scripts on POSIX
Type: enhancement Stage: resolved
Components: Distutils Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: packaging: generate scripts from callable (dotted paths)
View: 12394
Assigned To: tarek Nosy List: eric.araujo, kbk, tarek, timcera
Priority: low Keywords:

Created on 2004-08-06 16:00 by timcera, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg54228 - (view) Author: Tim Cera (timcera) Date: 2004-08-06 16:00
PROBLEM 
If a file installed as a script has Window cr-lf 
endings, even if the '#!/usr/bin/env python' is 
included to support direct execution on Linux, it 
doesn't work because the shell is confused by the 
cr-lf. 
 
This problem has been addressed in the newsgroups, 
with the usual solution to manually change the line 
endings, or only develop with an editor that can 
maintain Linux line endings. 
 
SOLUTION 
Convert line endings on installed scripts to the line 
endings appropriate to the machine running the 
installation.  Could be limited to Unix/Linux 
platform because Windows doesn't care about the line 
endings. 
 
kindest regards, 
tim 
msg54229 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-08-11 04:47
Logged In: YES 
user_id=149084

"Universal New Lines"
See PEP 278, implemented at Python 2.3.
It is better not to automagically modify the script
when running it.  However, there is a script
'crlf.py' in Tools/scripts which will convert
files with Windows line endings to Unix
line endings, if you wish to do that.
msg54230 - (view) Author: Tim Cera (timcera) Date: 2004-08-11 13:12
Logged In: YES 
user_id=169213

I put this back in distutils category instead of Python core.  I read over 
what I had written (and the response from kbk) and it is obvious that I 
wasn't clear. 
 
A Windows developer that uses distutils would be frustrated by their 
scripts not working on Unix/Linux because of the cr-lf endings, even if 
they had included the Unix/Linux '#!/usr/bin/env python' as the first 
line. 
 
I am asking that when _distutils_ installs an executable script that the 
line endings in each executable script are set to those appropriate for 
the target machine. 
 
In this way a Windows programer can ignore the line-ending formats of 
their scripts and distutils will quietly take care of the problem. 
 
sorry for the confusion and I hope that I have explained my idea 
better. 
msg102898 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-04-11 21:59
I’m shocked to learn this bug is still valid.

Reassigning to Distutils2, as Distutils is frozen. This bug is a particular case of #870479

Regards
msg112249 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-01 01:25
Marking as superseded.
msg138934 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-24 12:20
FTR, We’re going to follow setuptools’ lead and generate platform-appropriate script or binary files from callables.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40702
2011-06-24 12:20:38eric.araujosetsuperseder: Scripts need platform-dependent handling -> packaging: generate scripts from callable (dotted paths)
messages: + msg138934
2010-08-01 01:27:06eric.araujosetsuperseder: translate Windows newlines when installing scripts on POSIX -> Scripts need platform-dependent handling
2010-08-01 01:27:06eric.araujounlinkissue1004696 superseder
2010-08-01 01:25:18eric.araujosetstatus: open -> closed

superseder: translate Windows newlines when installing scripts on POSIX
components: + Distutils, - Distutils2
versions: + Python 3.2, - Python 3.1, Python 2.7
nosy: kbk, timcera, tarek, eric.araujo
messages: + msg112249
resolution: duplicate
stage: resolved
2010-08-01 01:25:18eric.araujolinkissue1004696 superseder
2010-04-11 21:59:37eric.araujosetnosy: kbk, timcera, tarek, eric.araujo
messages: + msg102898
components: + Distutils2, - Distutils
title: translate Windows cr-lf when installing scripts on Linux -> translate Windows newlines when installing scripts on POSIX
2010-04-09 00:00:14eric.araujosetnosy: + eric.araujo
2009-02-08 19:36:53tareksetassignee: tarek
versions: + Python 3.1, Python 2.7
2009-02-08 19:21:27akitadasetnosy: + tarek
2007-10-28 19:33:21kbksetassignee: kbk -> (no value)
2004-08-06 16:00:18timceracreate