-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_upload.py
executable file
·52 lines (44 loc) · 1.53 KB
/
plugin_upload.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
#!/usr/bin/env python
# This script uploads a plugin package on the server
#
# Author: fpsampayo
import os, sys
import getpass
from optparse import OptionParser
# Configuration
USER='root'
SERVER='10.0.0.90'
ENDPOINT='/var/www/qgis/'
def main(options, args):
print "Ejecutando SCP"
os.system('scp "%s" "%s@%s:%s"' % (args[0], USER, SERVER, ENDPOINT))
if __name__ == "__main__":
parser = OptionParser(usage="%prog [options] plugin.zip")
parser.add_option("-w", "--password", dest="password",
help="Password for plugin site", metavar="******")
parser.add_option("-u", "--username", dest="username",
help="Username of plugin site", metavar="user")
parser.add_option("-p", "--port", dest="port",
help="Server port to connect to", metavar="80")
parser.add_option("-s", "--server", dest="server",
help="Specify server name", metavar="plugins.qgis.org")
(options, args) = parser.parse_args()
if len(args) != 1:
print "Please specify zip file.\n"
parser.print_help()
sys.exit(1)
if not options.server:
options.server = SERVER
if not options.username:
# interactive mode
username = getpass.getuser()
print "Please enter user name [%s] :"%username,
res = raw_input()
if res != "":
options.username = res
else:
options.username = username
if not options.password:
# interactive mode
options.password = getpass.getpass()
main(options, args)