summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
diff options
context:
space:
mode:
authorJohannes Gijsbers <jlg@dds.nl>2004-09-11 16:34:35 (GMT)
committerJohannes Gijsbers <jlg@dds.nl>2004-09-11 16:34:35 (GMT)
commit7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088 (patch)
treeeaff8edea3793ee407b424b9096c443b9a0d06ec /Demo/scripts
parent9324526a7658c5450eba24b48065d87d5db5ab1f (diff)
downloadcpython-7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088.zip
cpython-7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088.tar.gz
cpython-7a8c43ee6a1f9c50bec8cc5234eff8b1d5e61088.tar.bz2
Add 'if __name__ == "__main__":' to files already as a usable as a module.
Diffstat (limited to 'Demo/scripts')
-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 deac4f8..165ca49 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 5497f66..03cab8b 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 13d0553..b37a58d 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 0af3cbd..8887dee 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 209f6c4..f70facd 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 3329351..bddec56 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 ba1f734..502d774 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 45a68b9..cacdda0 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 b9f9c0e..a631214 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 d633723..9b24245 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 00eb05f..5935a3c 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 e3b7be7..2d0b8e5 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 67a0783..32ad6c8 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()