summaryrefslogtreecommitdiffstats
path: root/Mac/Demo/example0/checktext.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-07-01 18:23:09 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-07-01 18:23:09 (GMT)
commitde9c869fb8c1f842bc3dfc4d51f287cb6b644ab2 (patch)
treeda0b9c0e9d56288354f936b59021d94018a172a8 /Mac/Demo/example0/checktext.py
parentbbfd71d7ac02bc2053a0ba494a3f055fbec8deee (diff)
downloadcpython-de9c869fb8c1f842bc3dfc4d51f287cb6b644ab2.zip
cpython-de9c869fb8c1f842bc3dfc4d51f287cb6b644ab2.tar.gz
cpython-de9c869fb8c1f842bc3dfc4d51f287cb6b644ab2.tar.bz2
Hopefully fix make framework install on Mac (see 3174)
Removal of the Mac modules broke many of the Mac scripts (including BuildApplet.py) so the building of the Python launcher and IDLE.app was broken. I manually copied built versions of those apps into Mac. Everything else which used Mac modules had to die.
Diffstat (limited to 'Mac/Demo/example0/checktext.py')
-rw-r--r--Mac/Demo/example0/checktext.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/Mac/Demo/example0/checktext.py b/Mac/Demo/example0/checktext.py
deleted file mode 100644
index 25f71e4..0000000
--- a/Mac/Demo/example0/checktext.py
+++ /dev/null
@@ -1,35 +0,0 @@
-"""checktext - Check that a text file has macintosh-style newlines"""
-
-import sys
-import EasyDialogs
-import string
-
-def main():
- pathname = EasyDialogs.AskFileForOpen(message='File to check end-of-lines in:')
- if not pathname:
- sys.exit(0)
- fp = open(pathname, 'rb')
- try:
- data = fp.read()
- except MemoryError:
- EasyDialogs.Message('Sorry, file is too big.')
- sys.exit(0)
- if len(data) == 0:
- EasyDialogs.Message('File is empty.')
- sys.exit(0)
- number_cr = string.count(data, '\r')
- number_lf = string.count(data, '\n')
- if number_cr == number_lf == 0:
- EasyDialogs.Message('File contains no lines.')
- if number_cr == 0:
- EasyDialogs.Message('File has unix-style line endings')
- elif number_lf == 0:
- EasyDialogs.Message('File has mac-style line endings')
- elif number_cr == number_lf:
- EasyDialogs.Message('File probably has MSDOS-style line endings')
- else:
- EasyDialogs.Message('File has no recognizable line endings (binary file?)')
- sys.exit(0)
-
-if __name__ == '__main__':
- main()