diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dotfiles.tar.gz | bin | 292124 -> 0 bytes | |||
-rwxr-xr-x | tools/getkey.py | 46 | ||||
-rwxr-xr-x | tools/merge_templates.py | 52 | ||||
-rwxr-xr-x | tools/pyed.py | 180 | ||||
-rwxr-xr-x | tools/sfupload.py | 46 | ||||
-rwxr-xr-x | tools/step.py | 47 | ||||
-rwxr-xr-x | tools/tweak_files.py | 46 | ||||
-rwxr-xr-x | tools/websync.py | 63 |
8 files changed, 0 insertions, 480 deletions
diff --git a/tools/dotfiles.tar.gz b/tools/dotfiles.tar.gz Binary files differdeleted file mode 100644 index 0636410..0000000 --- a/tools/dotfiles.tar.gz +++ /dev/null diff --git a/tools/getkey.py b/tools/getkey.py deleted file mode 100755 index 76c07de..0000000 --- a/tools/getkey.py +++ /dev/null @@ -1,46 +0,0 @@ -''' -This currently just holds some notes. -This is not expected to be working code. - -$Revision: 120 $ -$Date: 2002-11-27 11:13:04 -0800 (Wed, 27 Nov 2002) $ - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import tty, termios, sys - -def getkey(): - file = sys.stdin.fileno() - mode = termios.tcgetattr(file) - try: - tty.setraw(file, termios.TCSANOW) - ch = sys.stdin.read(1) - finally: - termios.tcsetattr(file, termios.TCSANOW, mode) - return ch - -def test_typing (): - s = screen (10,10) - while 1: - ch = getkey() - s.type(ch) - print str(s) - print - diff --git a/tools/merge_templates.py b/tools/merge_templates.py deleted file mode 100755 index b4fab18..0000000 --- a/tools/merge_templates.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -''' -I used to use this to keep the sourceforge pages up to date with the -latest documentation and I like to keep a copy of the distribution -on the web site so that it will be compatible with -The Vaults of Parnasus which requires a direct URL link to a -tar ball distribution. I don't advertise the package this way. - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -''' -import os -import re -import pyed - -# extract the version number from the pexpect.py source. -d = pyed.pyed() -d.read ("pexpect.py") -d.first('^__version__') -r = re.search("'([0-9]\.[0-9])'", d.cur_line) -version = r.group(1) - -# Edit the index.html to update current VERSION. -d = pyed.pyed() -d.read ("doc/index.template.html") -for cl in d.match_lines('.*VERSION.*'): - d.cur_line = d.cur_line.replace('VERSION', version) -d.write("doc/index.html") - -# Edit the setup.py to update current VERSION. -d = pyed.pyed() -d.read ("setup.py.template") -for cl in d.match_lines('.*VERSION.*'): - d.cur_line = d.cur_line.replace('VERSION', version) -d.write("setup.py") -os.chmod("setup.py", 0755) - diff --git a/tools/pyed.py b/tools/pyed.py deleted file mode 100755 index 14c562a..0000000 --- a/tools/pyed.py +++ /dev/null @@ -1,180 +0,0 @@ -"""This represents a document with methods to allow easy editing. -Think 'sed', only more fun to use. -Example 1: Convert all python-style comments in a file to UPPERCASE. -This operates as a filter on stdin, so this needs a shell pipe. -cat myscript.py | upper_filter.py - import sys, pyed - pe = pyed() - pe.read(sys.stdin) - for pe in pe.match_lines('^\\s*#'): - pe.cur_line = pe.cur_line.upper() - print pe - -Example 2: Edit an Apache2 httpd.conf file to turn on supplemental SSL configuration. - import pyed - pe = pyed() - pe.read("httpd.conf") - pe.first('#Include conf/extra/httpd-ssl.conf') - pe.cur_line = 'Include conf/extra/httpd-ssl.conf' - pe.write("httpd.conf") - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -""" - -import re -class pyed (object): - def __init__ (self, new_str=None): - if new_str is not None: - self.lines = new_str.splitlines() - self.cur_line_num = 0 - else: - self.lines = None - # force invalid line number - self.cur_line_num = None - def match_lines (self, pattern, beg=0, end=None): - """This returns a generator that iterates this object - over the lines and yielding when a line matches the pattern. - Note that this generator mutates this object so that - the cur_line is changed to the line matching the pattern. - """ - p = re.compile (pattern) - if end is None: - end = len(self.lines) - for i in xrange (beg,end): - m = p.match(self.lines[i]) - if m is not None: - self.cur_line_num = i - yield self - else: - # force invalid line number - cur_line_num = None - def match_lines_rev (self, pattern, beg=0, end=None): - """This is similar to match_lines, but the order is reversed. - """ - p = re.compile (pattern) - if end is None: - end = len(self.lines) - for i in xrange (end-1,beg-1,-1): - m = p.match(self.lines[i]) - if m is not None: - self.cur_line_num = i - yield self - else: - # force invalid line number - cur_line_num = None - def next (self): - self.cur_line_num = self.cur_line_num + 1 - if self.cur_line_num >= len(self.lines): - self.cur_line_num = len(self.lines) - 1 - return self.cur_line - def prev (self): - self.cur_line_num = self.cur_line_num - 1 - if self.cur_line_num < 0: - self.cur_line_num = 0 - return self.cur_line - def first (self, pattern=None): - if pattern is not None: - try: - return self.match_lines(pattern).next() - except StopIteration, e: - # force invalid line number - self.cur_line_num = None - return None - self.cur_line_num = 0 - return self.cur_line - def last (self, pattern=None): - if pattern is not None: - try: - return self.match_lines_rev(pattern).next() - except StopIteration, e: - # force invalid line number - self.cur_line_num = None - return None - self.cur_line_num = len(self.lines) - 1 - return self.cur_line - def insert (self, s=''): - """This inserts the string as a new line before the current line number. - """ - self.lines.insert(self.cur_line_num, s) - def append (self, s=''): - """Unlike list append, this appends after the current line number, - not at the end of the entire list. - """ - self.cur_line_num = self.cur_line_num + 1 - self.lines.insert(self.cur_line_num, s) - def delete (self): - del self.cur_line - def read (self, file_holder): - """This reads all the lines from a file. The file_holder may be - either a string filename or any object that supports "read()". - All previous lines are lost. - """ - if hasattr(file_holder, 'read') and callable(file_holder.read): - fin = file_holder - else: - fin = open (file_holder, 'rb') - data = fin.read() - self.lines = data.splitlines() - self.cur_line_num = 0 - def write (self, file_holder): - """This writes all the lines to a file. The file_holder may be - either a string filename or any object that supports "read()". - TODO: Make write be atomic using file move instead of overwrite. - """ - if hasattr(file_holder, 'write') and callable(file_holder.write): - fout = file_holder - else: - fout = open (file_holder, 'wb') - for l in self.lines: - fout.write(l) - fout.write('\n') - # the following are for smart properties. - def __str__ (self): - return '\n'.join(self.lines) - def __get_cur_line (self): - self.__cur_line = self.lines[self.cur_line_num] - return self.__cur_line - def __set_cur_line (self, value): - self.__cur_line = value - self.lines[self.cur_line_num] = self.__cur_line - def __del_cur_line (self): - del self.lines[self.cur_line_num] - if self.cur_line_num >= len(self.lines): - self.cur_line_num = len(self.lines) - 1 - cur_line = property (__get_cur_line, __set_cur_line, __del_cur_line) - # lines = property (get_lines, set_lines, del_lines) - -__NOT_USED =""" -import sys -pe = pyed() -pe.read(sys.stdin) -#print "---" -#print list(x.cur_line for x in pe.match_lines_rev('^#')) -#print pe.first('^#') -#print pe.last('^#') -#print "---" -for pe in pe.match_lines('^\\s*#'): - pe.cur_line = pe.cur_line.lower() -pe.last('# comment.*') -pe.cur_line = '# Comment 1' -print pe -if pe.last('asdfasdf') is None: - print "can't find 'asdfasdf'" -""" - diff --git a/tools/sfupload.py b/tools/sfupload.py deleted file mode 100755 index 8a3b078..0000000 --- a/tools/sfupload.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -'''This uploads the latest pexpect package to sourceforge. - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import sys - -child = pexpect.spawn('ftp upload.sourceforge.net') -child.logfile = sys.stdout -child.expect('Name .*: ') -child.sendline('anonymous') -child.expect('Password:') -child.sendline('noah@noah.org') -child.expect('ftp> ') -child.sendline('cd /incoming') -child.expect('ftp> ') -child.sendline('lcd dist') -child.expect('ftp> ') -child.sendline('bin') -child.expect('ftp> ') -child.sendline('prompt') -child.expect('ftp> ') -child.sendline('mput pexpect-*.tar.gz') -child.expect('ftp> ') -child.sendline('ls pexpect*') -child.expect('ftp> ') -print child.before -child.sendline('bye') - diff --git a/tools/step.py b/tools/step.py deleted file mode 100755 index cc0062e..0000000 --- a/tools/step.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -''' -# This single steps through a log file. - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import tty, termios, sys - -def getkey(): - file = sys.stdin.fileno() - mode = termios.tcgetattr(file) - try: - tty.setraw(file, termios.TCSANOW) - ch = sys.stdin.read(1) - finally: - termios.tcsetattr(file, termios.TCSANOW, mode) - return ch - -fin = open ('log', 'rb') -fout = open ('log2', 'wb') - -while 1: - foo = fin.read(1) - if foo == '': - sys.exit(0) - sys.stdout.write(foo) - getkey() - fout.write (foo) - fout.flush() - diff --git a/tools/tweak_files.py b/tools/tweak_files.py deleted file mode 100755 index 08481a2..0000000 --- a/tools/tweak_files.py +++ /dev/null @@ -1,46 +0,0 @@ -''' - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import pyed -import os -import re - -# extract the version number from the pexpect.py source. -d = pyed.pyed() -d.read ("pexpect.py") -d.first('^__version__') -r = re.search("'([0-9]\.[0-9])'", d.cur_line) -version = r.group(1) - -# Edit the index.html to update current VERSION. -d = pyed.pyed() -d.read ("doc/index.html.template") -for cl in d.match_lines('.*VERSION.*'): - d.cur_line = d.cur_line.replace('VERSION', version) -d.write("doc/index.html") - -# Edit the setup.py to update current VERSION. -d = pyed.pyed() -d.read ("setup.py.template") -for cl in d.match_lines('.*VERSION.*'): - d.cur_line = d.cur_line.replace('VERSION', version) -d.write("setup.py") -os.chmod("setup.py", 0755) diff --git a/tools/websync.py b/tools/websync.py deleted file mode 100755 index b7723e5..0000000 --- a/tools/websync.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python - -''' -I used to use this to keep the sourceforge pages up to date with the -latest documentation and I like to keep a copy of the distribution -on the web site so that it will be compatible with -The Vaults of Parnasus which requires a direct URL link to a -tar ball distribution. I don't advertise the package this way. - -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import pexpect -import getpass -import sys - -X = getpass.getpass('Password: ') -pp_pattern=["(?i)password:", "(?i)enter passphrase for key '.*?':"] - -p = pexpect.spawn ('scp -r doc/. noah@shell.sourceforge.net:/home/groups/p/pe/pexpect/htdocs/.') -p.logfile_read = sys.stdout -p.expect (pp_pattern) -p.sendline (X) -p.expect (pexpect.EOF) -print p.before - -p = pexpect.spawn ('scp doc/clean.css doc/email.png noah@shell.sourceforge.net:/home/groups/p/pe/pexpect/htdocs/clean.css') -p.logfile_read = sys.stdout -p.expect (pp_pattern) -p.sendline (X) -p.expect (pexpect.EOF) -print p.before - -#p = pexpect.spawn ('ssh noah@use-pr-shell1.sourceforge.net "cd htdocs;tar zxvf pexpect-doc.tgz"') -#p.logfile_read = sys.stdout -#p.expect ('password:') -#p.sendline (X) -#p.expect (pexpect.EOF) -#print p.before - -p = pexpect.spawn ('scp dist/pexpect-*.tar.gz noah@shell.sourceforge.net:/home/groups/p/pe/pexpect/htdocs/.') -p.logfile_read = sys.stdout -p.expect (pp_pattern) -p.sendline (X) -p.expect (pexpect.EOF) -print p.before - |