/usr/lib/python2.7/dist-packages/libwfut/wfut-python.py is in python-libwfut-0.2 0.2.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/python
import os, sys
from ConfigParser import ConfigParser
from libwfut import WFUT
from libwfut import WFUTCore
## Read global/local config files
def loadConfig():
## Construct filename for user config file
filename = os.path.join(os.environ['HOME'], '.libwfutrc');
config = ConfigParser();
## TODO: Move into a setDefaults() method?
## Set some default values
config.add_section("general");
config.set("general", "server_root", "http://white.worldforgedev.org/WFUT/");
## Read user config file.
config.read([filename]);
## TODO: We do not need to do this all the time...
## Save config file
fp = open(filename, "w");
config.write(fp);
fp.close();
return config;
##def printUsage(invoked):
## print invoked." -u channel_name OPTIONS";
## print "-u channel name\t (Required) May be '.' to determine from current dir";
## print "-s system_path\t Path containing system/read-only channel data"
## print "-S server_root\t Url to remote server root";
## print "-p local_path\t Path to local updates dir. Current dir is used by default.";
## Load user config
config = loadConfig();
## Setup default values
server_root = config.get("general", "server_root");
channel = ".";
local_path = "./";
system_path = "";
use_avahi = False
## Arguments parsing function
import getopt
optlist, args = getopt.getopt(sys.argv[1:], "u:s:p:vS:hL")
for (arg, opt) in optlist:
if arg == '-u': channel = opt;
if arg == '-s': system_path = opt;
if arg == '-S': server_root = opt;
if arg == '-p': local_path = opt;
if arg == '-v': pass
if arg == '-h': pass
if arg == '-L': use_avahi = True
## If scan local network;
if use_avahi:
try:
## Use wfut-avahi-client to return a sever root url
import WFUTAvahiClient;
server_root = WFUTAvahiClient.go();
except Exception as e:
print e;
## Check we have required data input
if channel == ".":
print "No channel specified, will try using current directory";
client = WFUTCore.Client();
client.setChannelName(channel);
client.setLocalPath(local_path);
client.setSystemPath(system_path);
client.setServerRoot(server_root);
client.startUpdates();
while (client.poll()):
pass
client.__deinit__();
|