summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Gijsbers <jlg@dds.nl>2004-09-11 16:34:35 +0000
committerJohannes Gijsbers <jlg@dds.nl>2004-09-11 16:34:35 +0000
commit7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088 (patch)
treeeaff8edea3793ee407b424b9096c443b9a0d06ec
parent9324526a7658c5450eba24b48065d87d5db5ab1f (diff)
downloadcpython-git-7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088.tar.gz
Add 'if __name__ == "__main__":' to files already as a usable as a module.
-rwxr-xr-xDemo/scripts/eqfix.py4
-rwxr-xr-xDemo/scripts/fact.py3
-rwxr-xr-xDemo/scripts/ftpstats.py3
-rwxr-xr-xDemo/scripts/lpwatch.py9
-rwxr-xr-xDemo/scripts/makedir.py3
-rwxr-xr-xDemo/scripts/markov.py3
-rwxr-xr-xDemo/scripts/mboxconvert.py3
-rwxr-xr-xDemo/scripts/mkrcs.py3
-rwxr-xr-xDemo/scripts/newslist.py4
-rwxr-xr-xDemo/scripts/pi.py3
-rwxr-xr-xDemo/scripts/primes.py3
-rwxr-xr-xDemo/scripts/unbirthday.py3
-rwxr-xr-xDemo/scripts/update.py3
13 files changed, 29 insertions, 18 deletions
diff --git a/Demo/scripts/eqfix.py b/Demo/scripts/eqfix.py
index deac4f8a61..165ca4906b 100755
--- a/Demo/scripts/eqfix.py
+++ b/Demo/scripts/eqfix.py
@@ -194,5 +194,5 @@ def fixline(line):
print line,
return line
-
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index 5497f6650e..03cab8bb85 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -45,4 +45,5 @@ def main():
except EOFError:
pass
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 13d055313a..b37a58d9bd 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -141,4 +141,5 @@ def add(dict, key, item):
else:
dict[key] = [item]
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 0af3cbd056..8887dee7d3 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -103,7 +103,8 @@ def makestatus(name, thisuser):
lines.append('lpq exit status %r' % (sts,))
return string.joinfields(lines, ': ')
-try:
- main()
-except KeyboardInterrupt:
- pass
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
diff --git a/Demo/scripts/makedir.py b/Demo/scripts/makedir.py
index 209f6c4385..f70facd081 100755
--- a/Demo/scripts/makedir.py
+++ b/Demo/scripts/makedir.py
@@ -17,4 +17,5 @@ def makedirs(p):
makedirs(head)
os.mkdir(p, 0777)
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/markov.py b/Demo/scripts/markov.py
index 3329351b95..bddec56936 100755
--- a/Demo/scripts/markov.py
+++ b/Demo/scripts/markov.py
@@ -113,4 +113,5 @@ def tuple(list):
i = len(list)/2
return tuple(list[:i]) + tuple(list[i:])
-test()
+if __name__ == "__main__":
+ test()
diff --git a/Demo/scripts/mboxconvert.py b/Demo/scripts/mboxconvert.py
index ba1f734384..502d774f83 100755
--- a/Demo/scripts/mboxconvert.py
+++ b/Demo/scripts/mboxconvert.py
@@ -120,4 +120,5 @@ def message(f, delimiter = ''):
print
return sts
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/mkrcs.py b/Demo/scripts/mkrcs.py
index 45a68b92c4..cacdda0a54 100755
--- a/Demo/scripts/mkrcs.py
+++ b/Demo/scripts/mkrcs.py
@@ -57,4 +57,5 @@ def makedirs(p):
makedirs(head)
os.mkdir(p, 0777)
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/newslist.py b/Demo/scripts/newslist.py
index b9f9c0ea11..a631214980 100755
--- a/Demo/scripts/newslist.py
+++ b/Demo/scripts/newslist.py
@@ -359,8 +359,8 @@ def main():
createpage(rootpage, tree, '')
print 'Done'
-
-main()
+if __name__ == "__main__":
+ main()
# That's all folks
######################################################################
diff --git a/Demo/scripts/pi.py b/Demo/scripts/pi.py
index d6337238a8..9b242451aa 100755
--- a/Demo/scripts/pi.py
+++ b/Demo/scripts/pi.py
@@ -30,4 +30,5 @@ def output(d):
# Flush so the output is seen immediately
sys.stdout.flush()
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/primes.py b/Demo/scripts/primes.py
index 00eb05f9b1..5935a3c84a 100755
--- a/Demo/scripts/primes.py
+++ b/Demo/scripts/primes.py
@@ -23,4 +23,5 @@ def primes(min, max):
if i >= min: print i
i = i+2
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/unbirthday.py b/Demo/scripts/unbirthday.py
index e3b7be73f0..2d0b8e5f40 100755
--- a/Demo/scripts/unbirthday.py
+++ b/Demo/scripts/unbirthday.py
@@ -103,4 +103,5 @@ def mkdate((year, month, day)):
days = days + day
return days
-main()
+if __name__ == "__main__":
+ main()
diff --git a/Demo/scripts/update.py b/Demo/scripts/update.py
index 67a07838da..32ad6c86e1 100755
--- a/Demo/scripts/update.py
+++ b/Demo/scripts/update.py
@@ -88,4 +88,5 @@ def main():
curfile = FileObj(filename)
curfile.process(lineno, line[n:])
-main()
+if __name__ == "__main__":
+ main()