gitso

gitso Commit Details


Date:2008-10-25 16:54:25 (16 years 1 month ago)
Author:gerberad
Branch:master
Commit:00574e2399b77a9cf180511ed3398eefa19e6ca0
Parents: 407217532191090014de0b53cfcb6821277994a7
Message:Wrote manpage (linux). Added support for --listen, --dev, --connect, --help. Rewrote makegitso.pl in bash. Optimized timing in the threads.

Changes:

File differences

gitso/trunk/ArgsParser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#! /usr/bin/env python
"""
Gisto - Gitso is to support others
Gitso is a utility to facilitate the connection of VNC
@author: Aaron Gerber ('gerberad')
@author: Derek Buranen ('burner') <derek@buranen.info>
@copyright: 2007-2008
"""
import os, sys, signal, os.path
class ArgsParser:
def __init__(self):
# Initialize Self.paths here.
self.paths = dict()
self.paths['resources'] = os.path.join(sys.path[0], "./")
self.paths['preferences'] = ''
self.paths['copyright'] = ''
self.paths['main'] = ''
self.paths['listen'] = False
self.paths['connect'] = ''
if sys.platform.find('linux') != -1:
self.paths['main'] = os.path.join(sys.path[0], '..', 'share', 'gitso')
self.paths['copyright'] = os.path.join(sys.path[0], '..', 'share', 'doc', 'gitso', 'copyright')
else:
self.paths['main'] = os.path.join(sys.path[0])
self.paths['copyright'] = os.path.join(sys.path[0], 'copyright')
#for i in range(1, len(sys.argv)):
i = 1
while i < len(sys.argv):
if sys.argv[i] == '--dev': # --dev
if sys.platform == "darwin":
self.paths['resources'] = 'arch/osx/'
elif sys.platform == "w32":
self.paths['resources'] = 'arch/win32/'
else:
self.paths['resources'] = 'arch/linux/'
self.paths['main'] = os.path.join(sys.path[0])
self.paths['copyright'] = os.path.join(sys.path[0], 'copyright')
elif sys.argv[i] == '--listen': # --listen
if self.paths['connect'] <> "":
print "Error: --connect and --listen can not be used at the same time."
self.HelpMenu()
self.paths['listen'] = True
elif sys.argv[i] == '--connect': # --connect
i = i + 1
if i >= len(sys.argv) or self.paths['listen']:
print "Error: --connect and --listen can not be used at the same time."
self.HelpMenu()
if sys.argv[i][0] + sys.argv[i][1] <> "--":
self.paths['connect'] = sys.argv[i]
else:
print "Error: '" + sys.argv[i] + "' is host with '--connect'."
self.HelpMenu()
else:
print "Error: '" + sys.argv[i] + "' is not a valid argument."
self.HelpMenu()
i = i + 1
if sys.platform == "darwin":
self.paths['preferences'] = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Gitso")
if os.path.exists(self.paths['preferences']) != True:
os.makedirs(self.paths['preferences'], 0700)
self.paths['preferences'] = os.path.join(self.paths['preferences'], "hosts")
elif sys.platform == "win32":
self.paths['preferences'] = os.path.join(os.path.expanduser("~"), "Local Settings", "Application Data", ".gitso-hosts")
else:
self.paths['preferences'] = os.path.join(os.path.expanduser("~"), ".gitso-hosts")
#Help Menu
def HelpMenu(self):
print "Usage: " + os.path.basename(sys.argv[0]) + " [OPTION]"
print " OPTIONS"
print " --dev\t\tSet self.paths for development."
print " --listen\t\tlisten for incoming connections."
print " --connect {IP|DN}\tConnects to host (support giver)."
print " --list {URL|LIST}\tAlternative Support list."
print " --help\t\tThis Menu."
exit(0)
def GetPaths(self):
return self.paths
gitso/trunk/ConnectionWindow.py
111111
112112
113113
114
115
116
117
118
119
120
121
122
123
114124
115125
116126
......
295305
296306
297307
298
308
299309
self.SetThemeEnabled(True)
self.Centre()
self.Show(True)
if self.paths['listen']:
self.rb2.Value = True
self.RadioToggle(None)
self.ConnectSupport(None)
elif self.paths['connect'] <> "":
self.rb1.Value = True
self.RadioToggle(None)
self.hostField.Value = self.paths['connect']
self.ConnectSupport(None)
def RadioToggle(self, event):
# If you don't wait 2 seconds, the interface won't reload and it'll freeze.
# Possibly on older systems you should wait longer, it works fine on mine...
time.sleep(2)
time.sleep(1)
gitso/trunk/Gitso.py
1111
1212
1313
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
14
6515
6616
6717
68
18
19
6920
7021
"""
import wx
import os, sys, signal, os.path
import ConnectionWindow, GitsoThread
#Help Menu
def help_menu():
print "Usage: " + os.path.basename(sys.argv[0]) + " [OPTION]"
print " OPTIONS"
print " --dev\t\tSet paths for development."
print " --host {IP|DN}\tConnects to host (support giver)."
print " --list {URL|LIST}\tAlternative Support list."
print " --help\t\tThis Menu."
exit(0)
# Initialize Paths here.
paths = dict()
paths['resources'] = os.path.join(sys.path[0], "./")
paths['preferences'] = ''
paths['copyright'] = ''
paths['main'] = ''
if sys.platform.find('linux') != -1:
paths['main'] = os.path.join(sys.path[0], '..', 'share', 'gitso')
paths['copyright'] = os.path.join(sys.path[0], '..', 'share', 'doc', 'gitso', 'copyright')
else:
paths['main'] = os.path.join(sys.path[0])
paths['copyright'] = os.path.join(sys.path[0], 'copyright')
if len(sys.argv) == 2:
if sys.argv[1] == '--dev':
if sys.platform == "darwin":
paths['resources'] = 'arch/osx/'
elif sys.platform == "w32":
paths['resources'] = 'arch/win32/'
else:
paths['resources'] = 'arch/linux/'
paths['main'] = os.path.join(sys.path[0])
paths['copyright'] = os.path.join(sys.path[0], 'copyright')
else:
help_menu()
elif len(sys.argv) > 2:
help_menu()
if sys.platform == "darwin":
paths['preferences'] = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Gitso")
if os.path.exists(paths['preferences']) != True:
os.makedirs(paths['preferences'], 0700)
paths['preferences'] = os.path.join(paths['preferences'], "hosts")
elif sys.platform == "win32":
paths['preferences'] = os.path.join(os.path.expanduser("~"), "Local Settings", "Application Data", ".gitso-hosts")
else:
paths['preferences'] = os.path.join(os.path.expanduser("~"), ".gitso-hosts")
import ConnectionWindow, ArgsParser
if __name__ == "__main__":
app = wx.PySimpleApp()
ConnectionWindow.ConnectionWindow(None, -1, "Gitso", paths)
args = ArgsParser.ArgsParser()
ConnectionWindow.ConnectionWindow(None, -1, "Gitso", args.GetPaths())
app.MainLoop()
del app
gitso/trunk/GitsoThread.py
3737
3838
3939
40
40
4141
4242
4343
......
5858
5959
6060
61
62
6163
62
63
64
65
66
67
6468
6569
6670
67
68
69
71
72
73
74
7075
7176
72
73
7477
7578
7679
print "GitsoThread.run(pid: " + str(self.pid) + ") running..."
while(self.running and self.checkStatus()):
time.sleep(.5)
time.sleep(.2)
if not self.error:
self.window.setMessage("Idle.", False)
if self.pid == 0:
return False
connection = []
listen = []
if sys.platform == 'darwin' or sys.platform.find('linux') != -1:
connection = os.popen('netstat -an | grep 5500 | grep ESTABLISHED').readlines()
listen = os.popen('netstat -an | grep 5500 | grep LISTEN').readlines()
if self.host <> "":
connection = os.popen('netstat -an | grep 5500 | grep ESTABLISHED').readlines()
else:
listen = os.popen('netstat -an | grep 5500 | grep LISTEN').readlines()
elif sys.platform == 'win32':
#XP PRO only -- Need to fix the case where there is no process, it'll still return 1 line.
#info = os.popen('WMIC PROCESS ' + str(self.pid) + ' get Processid').readlines()
# possibly
connection = os.popen('netstat -a | find "ESTABLISHED" | find "5500"').readlines()
listen = os.popen('netstat -a | find "LISTEN" | find "5500"').readlines()
if self.host <> "":
connection = os.popen('netstat -a | find "ESTABLISHED" | find "5500"').readlines()
else:
listen = os.popen('netstat -a | find "LISTEN" | find "5500"').readlines()
else:
print 'Platform not detected'
connection = array()
listen = array()
if len(connection) == 0 and len(listen) == 0:
return False
gitso/trunk/arch/linux/control
11
2
2
33
44
55
Package: gitso
Version: 0.5
Version: 0.6
Priority: optional
Section: utils
Architecture: all
gitso/trunk/arch/linux/gitso
33
44
55
6
6
77
88
99
10
10
11
1112
13
import sys, os, wx
sys.path.append(os.path.join(sys.path[0], '..', 'share', 'gitso'))
from Gitso import Connect
from Gitso import ConnectionWindow, ArgsParser
if __name__ == "__main__":
app = wx.PySimpleApp()
Connect(None, -1, "Gitso")
args = ArgsParser.ArgsParser()
ConnectionWindow.ConnectionWindow(None, -1, "Gitso", args.GetPaths())
app.MainLoop()
del app
gitso/trunk/arch/linux/gitso.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.TH GITSO 1 "October 2008" "gitso-0.6" "Gitso"
.SH NAME
gitso - Gitso is to support others
.SH SYNOPSIS
.B gitso
[
.B --dev
|
.B --listen
|
.B --connect
.I host
|
.B --list
.I list
|
.B --help
]
.SH DESCRIPTION
Gitso is a frontend to reverse VNC connections. It is meant to be a simple two-step process that connects one person to another's screen in the context of giving technical support.
.SH OPTIONS
.TP
.B --dev
Configures paths for running Gitso in the source tree.
.TP
.B --listen
Start Gitso and listen for incoming connections
.TP
.B --connect
Starts gitso and automatically connects to
.I host
which is an IP or domain name (address of support giver).
.TP
.B --list
Alternative support list, where
.I list
is either a URL of a remote file list or a comma seperated list
.TP
.B --help
Display the help menu.
.SH HOST FILES
.I $HOME/.gitso-hosts
.I /usr/share/gitso/hosts.txt
.SH EXAMPLES
.TP
gitso --list support.mydomain.com/techs.txt
Gets the list of technician IP's or DN's from techs.txt
.TP
gitso --list sanda.mydomain.com,aicha.mydomain.com
Adds these three entries to the list of support techs.
.TP
gitso --connect hank.mydomain.com
Automatically connects to hank.mydomain.com
.SH SEE ALSO
.I x11vnc
.I vncviewer
.SH AUTHOR
Aaron Gerber and Derek Buranen
gitso/trunk/makegitso.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /usr/bin/perl -w
use warnings;
use strict;
if(`uname -a` =~ m/Darwin/) {
if(`which py2applet` ne "") {
print "Creating Gitso.app ";
`rm -f setup.py`;
`rm -rf dist`;
print "..";
`py2applet --make-setup Gitso.py`;
print "..";
`python setup.py py2app`;
print "..";
`cp arch/osx/Info.plist dist/Gitso.app/Contents/`;
`cp copyright dist/Gitso.app/Contents/Resources/`;
`cp PythonApplet.icns dist/Gitso.app/Contents/Resources/`;
`tar xvfz arch/osx/OSXvnc.tar.gz`;
`mv OSXvnc dist/Gitso.app/Contents/Resources/`;
`tar xvfz arch/osx/vncviewer.tar.gz`;
`mv vncviewer dist/Gitso.app/Contents/Resources/`;
print " [done]\n";
print "Creating Gitso.dmg ";
`rm -f Gitso.dmg`;
`mkdir dist/Gitso`;
`cp arch/osx/dmg_DS_Store dist/Gitso/.DS_Store`;
`ln -s /Applications/ dist/Gitso/Applications`;
`mv "dist/Gitso.app" "dist/Gitso/"`;
`cp -r arch/osx/Readme.rtfd dist/Gitso/Readme.rtfd`;
print "...";
`hdiutil create -srcfolder dist/Gitso/ Gitso.dmg`;
print "... [done]\n";
} else {
print "Error, you need py2applet to be installed.";
}
} elsif (`uname -a` =~ m/Linux/) {
my $deb = "gitso_0.5_all.deb";
my $path = "gitso";
print "Creating $path.deb";
`rm -rf $path`;
`mkdir $path`;
`mkdir $path/DEBIAN`;
`cp arch/linux/control $path/DEBIAN`;
print "..";
`mkdir $path/usr`;
`mkdir $path/usr/bin`;
`mkdir $path/usr/share`;
`mkdir $path/usr/share/applications`;
`mkdir $path/usr/share/doc`;
`mkdir $path/usr/share/doc/$path`;
`mkdir $path/usr/share/$path`;
`cp arch/linux/gitso $path/usr/bin/`;
`chmod 755 $path/usr/bin/gitso`;
`cp Gitso.py $path/usr/share/$path/`;
`cp __init__.py $path/usr/share/$path/`;
`cp hosts.txt $path/usr/share/$path/`;
`cp icon.ico $path/usr/share/$path/`;
print "..";
`cp arch/linux/gitso.desktop $path/usr/share/applications/`;
`cp arch/linux/README.txt $path/usr/share/doc/$path/README`;
`cp copyright $path/usr/share/doc/$path/`;
`gzip -cf arch/linux/changelog > $path/usr/share/doc/$path/changelog.gz`;
print "..";
`dpkg -b $path/ $deb`;
#`rm -rf $path`;
print " [done]\n";
}
gitso/trunk/makegitso.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /bin/bash
if [ "$1" = "" ]; then
CLEAN="yes"
elif test "$1" = "--no-clean"; then
CLEAN="no"
else
echo -e "Usage makegitso.sh: [ --no-clean | --help ]"
echo -e "\tOptions:"
echo -e "\t--no-clean\tDo not remove the build directory."
echo -e "\t--help \tThese options."
exit 0
fi
if test `uname -a | grep Darwin`; then
if test `which py2applet`; then
echo -e "Creating Gitso.app "
rm -f setup.py
rm -rf dist
echo -e ".."
py2applet --make-setup Gitso.py
echo -e ".."
python setup.py py2app
echo -e ".."
cp arch/osx/Info.plist dist/Gitso.app/Contents/
cp copyright dist/Gitso.app/Contents/Resources/
cp PythonApplet.icns dist/Gitso.app/Contents/Resources/
tar xvfz arch/osx/OSXvnc.tar.gz
mv OSXvnc dist/Gitso.app/Contents/Resources/
tar xvfz arch/osx/vncviewer.tar.gz
mv vncviewer dist/Gitso.app/Contents/Resources/
echo -e " [done]\n"
echo -e "Creating Gitso.dmg "
rm -f Gitso.dmg
mkdir dist/Gitso
cp arch/osx/dmg_DS_Store dist/Gitso/.DS_Store
ln -s /Applications/ dist/Gitso/Applications
mv "dist/Gitso.app" "dist/Gitso/"
cp -r arch/osx/Readme.rtfd dist/Gitso/Readme.rtfd
echo -e "..."
hdiutil create -srcfolder dist/Gitso/ Gitso.dmg
echo -e "... [done]\n"
else
echo -e "Error, you need py2applet to be installed."
fi
elif test "`uname -a 2>&1 | grep Linux | grep -v which`"; then
DEB="gitso_0.6_all.deb"
BUILDPATH="gitso"
echo -n "Creating $DEB"
rm -rf $BUILDPATH
mkdir -p $BUILDPATH/DEBIAN
mkdir -p $BUILDPATH/usr/bin
mkdir -p $BUILDPATH/usr/share/applications
mkdir -p $BUILDPATH/usr/share/doc/$BUILDPATH
mkdir -p $BUILDPATH/usr/share/$BUILDPATH
mkdir -p $BUILDPATH/usr/share/man/man1
echo -n ".."
cp arch/linux/control $BUILDPATH/DEBIAN
cp arch/linux/gitso $BUILDPATH/usr/bin/
chmod 755 $BUILDPATH/usr/bin/gitso
cp Gitso.py $BUILDPATH/usr/share/$BUILDPATH/
cp ConnectionWindow.py $BUILDPATH/usr/share/$BUILDPATH/
cp AboutWindow.py $BUILDPATH/usr/share/$BUILDPATH/
cp GitsoThread.py $BUILDPATH/usr/share/$BUILDPATH/
cp Processes.py $BUILDPATH/usr/share/$BUILDPATH/
cp ArgsParser.py $BUILDPATH/usr/share/$BUILDPATH/
cp __init__.py $BUILDPATH/usr/share/$BUILDPATH/
cp hosts.txt $BUILDPATH/usr/share/$BUILDPATH/
cp icon.ico $BUILDPATH/usr/share/$BUILDPATH/
echo -n ".."
cp arch/linux/gitso.desktop $BUILDPATH/usr/share/applications/
cp arch/linux/README.txt $BUILDPATH/usr/share/doc/$BUILDPATH/README
cp copyright $BUILDPATH/usr/share/doc/$BUILDPATH/
gzip -cf arch/linux/changelog > $BUILDPATH/usr/share/doc/$BUILDPATH/changelog.gz
gzip -cf arch/linux/gitso.1 > $BUILDPATH/usr/share/man/man1/gitso.1.gz
echo -n ".."
dpkg -b $BUILDPATH/ $DEB 2>&1 > /dev/null
if [ "$CLEAN" = "yes" ]; then
rm -rf $BUILDPATH
fi
echo -e " [done]\n"
fi

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.10797s using 13 queries.