Skip to content
Snippets Groups Projects
Commit ecb7e180 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Remove dead python files

parent 9c7c331b
No related branches found
No related tags found
1 merge request!35Convert viewer tree to utilize python3
#!/usr/bin/env python3
##
## $LicenseInfo:firstyear=2011&license=viewerlgpl$
## Second Life Viewer Source Code
## Copyright (C) 2011, Linden Research, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation;
## version 2.1 of the License only.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
##
## Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
## $/LicenseInfo$
import sys
import os
import glob
def delete_file_types(path, filetypes):
if os.path.exists(path):
print('Cleaning: ' + path)
orig_dir = os.getcwd();
os.chdir(path)
filelist = []
for type in filetypes:
filelist.extend(glob.glob(type))
for file in filelist:
os.remove(file)
os.chdir(orig_dir)
def main():
build_types = ['*.exp','*.exe','*.pdb','*.idb',
'*.ilk','*.lib','*.obj','*.ib_pdb_index']
pch_types = ['*.pch']
delete_file_types("build-vc80/newview/Release", build_types)
delete_file_types("build-vc80/newview/alchemy-bin.dir/Release/",
pch_types)
delete_file_types("build-vc80/newview/RelWithDebInfo", build_types)
delete_file_types("build-vc80/newview/alchemy-bin.dir/RelWithDebInfo/",
pch_types)
delete_file_types("build-vc80/newview/Debug", build_types)
delete_file_types("build-vc80/newview/alchemy-bin.dir/Debug/",
pch_types)
delete_file_types("build-vc80/test/RelWithDebInfo", build_types)
delete_file_types("build-vc80/test/test.dir/RelWithDebInfo/",
pch_types)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""\
@file test_win32_manifest.py
@brief Test an assembly binding version and uniqueness in a windows dll or exe.
$LicenseInfo:firstyear=2009&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2009-2011, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2.1 of the License only.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
import sys, os
import tempfile
from xml.dom.minidom import parse
class AssemblyTestException(Exception):
pass
class NoManifestException(AssemblyTestException):
pass
class MultipleBindingsException(AssemblyTestException):
pass
class UnexpectedVersionException(AssemblyTestException):
pass
class NoMatchingAssemblyException(AssemblyTestException):
pass
def get_HKLM_registry_value(key_str, value_str):
import winreg
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
key = winreg.OpenKey(reg, key_str)
value = winreg.QueryValueEx(key, value_str)[0]
#print 'Found: %s' % value
return value
def find_vc_dir():
supported_versions = (r'8.0', r'9.0')
supported_products = (r'VisualStudio', r'VCExpress')
value_str = (r'ProductDir')
for product in supported_products:
for version in supported_versions:
key_str = (r'SOFTWARE\Microsoft\%s\%s\Setup\VC' %
(product, version))
try:
return get_HKLM_registry_value(key_str, value_str)
except WindowsError as err:
x64_key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' %
version)
try:
return get_HKLM_registry_value(x64_key_str, value_str)
except:
print("Didn't find MS %s version %s " % (product,version), file=sys.stderr)
raise
def find_mt_path():
vc_dir = find_vc_dir()
mt_path = '\"%sbin\\mt.exe\"' % vc_dir
return mt_path
def test_assembly_binding(src_filename, assembly_name, assembly_ver):
print("checking %s dependency %s..." % (src_filename, assembly_name))
(tmp_file_fd, tmp_file_name) = tempfile.mkstemp(suffix='.xml')
tmp_file = os.fdopen(tmp_file_fd)
tmp_file.close()
mt_path = find_mt_path()
resource_id = ""
if os.path.splitext(src_filename)[1].lower() == ".dll":
resource_id = ";#2"
system_call = '%s -nologo -inputresource:%s%s -out:%s > NUL' % (mt_path, src_filename, resource_id, tmp_file_name)
print("Executing: %s" % system_call)
mt_result = os.system(system_call)
if mt_result == 31:
print("No manifest found in %s" % src_filename)
raise NoManifestException()
manifest_dom = parse(tmp_file_name)
nodes = manifest_dom.getElementsByTagName('assemblyIdentity')
versions = list()
for node in nodes:
if node.getAttribute('name') == assembly_name:
versions.append(node.getAttribute('version'))
if len(versions) == 0:
print("No matching assemblies found in %s" % src_filename)
raise NoMatchingAssemblyException()
elif len(versions) > 1:
print("Multiple bindings to %s found:" % assembly_name)
print(versions)
print()
raise MultipleBindingsException(versions)
elif versions[0] != assembly_ver:
print("Unexpected version found for %s:" % assembly_name)
print("Wanted %s, found %s" % (assembly_ver, versions[0]))
print()
raise UnexpectedVersionException(assembly_ver, versions[0])
os.remove(tmp_file_name)
print("SUCCESS: %s OK!" % src_filename)
print()
if __name__ == '__main__':
print()
print("Running test_win32_manifest.py...")
usage = 'test_win32_manfest <srcFileName> <assemblyName> <assemblyVersion>'
try:
src_filename = sys.argv[1]
assembly_name = sys.argv[2]
assembly_ver = sys.argv[3]
except:
print("Usage:")
print(usage)
print()
raise
test_assembly_binding(src_filename, assembly_name, assembly_ver)
#!/usr/bin/env python3
"""\
@file test_llsdmessage_peer.py
@author Nat Goodspeed
@date 2008-10-09
@brief This script asynchronously runs the executable (with args) specified on
the command line, returning its result code. While that executable is
running, we provide dummy local services for use by C++ tests.
$LicenseInfo:firstyear=2008&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2010, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2.1 of the License only.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
import os
import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
from llbase.fastest_elementtree import parse as xml_parse
from llbase import llsd
from testrunner import freeport, run, debug, VERBOSE
import time
_storage=None
class TestHTTPRequestHandler(BaseHTTPRequestHandler):
"""This subclass of BaseHTTPRequestHandler is to receive and echo
LLSD-flavored messages sent by the C++ LLHTTPClient.
"""
def read(self):
# The following logic is adapted from the library module
# SimpleXMLRPCServer.py.
# Get arguments by reading body of request.
# We read this in chunks to avoid straining
# socket.read(); around the 10 or 15Mb mark, some platforms
# begin to have problems (bug #792570).
try:
size_remaining = int(self.headers["content-length"])
except (KeyError, ValueError):
return ""
max_chunk_size = 10*1024*1024
L = []
while size_remaining:
chunk_size = min(size_remaining, max_chunk_size)
chunk = self.rfile.read(chunk_size)
L.append(chunk)
size_remaining -= len(chunk)
return ''.join(L)
# end of swiped read() logic
def read_xml(self):
# This approach reads the entire POST data into memory first
return llsd.parse(self.read())
## # This approach attempts to stream in the LLSD XML from self.rfile,
## # assuming that the underlying XML parser reads its input file
## # incrementally. Unfortunately I haven't been able to make it work.
## tree = xml_parse(self.rfile)
## debug("Finished raw parse")
## debug("parsed XML tree %s", tree)
## debug("parsed root node %s", tree.getroot())
## debug("root node tag %s", tree.getroot().tag)
## return llsd.to_python(tree.getroot())
def do_HEAD(self):
self.do_GET(withdata=False)
def do_GET(self, withdata=True):
# Of course, don't attempt to read data.
data = dict(reply="success", body="avatar", random=17)
self.answer(data, withdata=withdata)
def do_POST(self):
# Read the provided POST data.
self.answer(self.read_xml())
def do_PUT(self):
# Read the provided PUT data.
self.answer(self.read_xml())
def answer(self, data, withdata=True):
global _storage
debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
if "fail" in self.path or "test/error" in self.path: # fail requested
status = data.get("status", 500)
# self.responses maps an int status to a (short, long) pair of
# strings. We want the longer string. That's why we pass a string
# pair to get(): the [1] will select the second string, whether it
# came from self.responses or from our default pair.
reason = data.get("reason",
self.responses.get(status,
("fail requested",
"Your request specified failure status %s "
"without providing a reason" % status))[1])
debug("fail requested: %s: %r", status, reason)
self.send_error(status, reason)
else:
if "web/echo" in self.path:
pass
elif "test/timeout" in self.path:
time.sleep(5.0)
return
elif "test/storage" in self.path:
if "GET" == self.command:
data = _storage
else:
_storage = data
data = "ok"
else:
data = data.copy() # we're going to modify
# Ensure there's a "reply" key in data, even if there wasn't before
data["reply"] = data.get("reply", llsd.LLSD("success"))
response = llsd.format_xml(data)
debug("success: %s", response)
self.send_response(200)
self.send_header("Content-type", "application/llsd+xml")
self.send_header("Content-Length", str(len(response)))
self.end_headers()
if withdata:
self.wfile.write(response)
if not VERBOSE:
# When VERBOSE is set, skip both these overrides because they exist to
# suppress output.
def log_request(self, code, size=None):
# For present purposes, we don't want the request splattered onto
# stderr, as it would upset devs watching the test run
pass
def log_error(self, format, *args):
# Suppress error output as well
pass
class Server(HTTPServer):
# This pernicious flag is on by default in HTTPServer. But proper
# operation of freeport() absolutely depends on it being off.
allow_reuse_address = False
if __name__ == "__main__":
# function to make a server with specified port
make_server = lambda port: Server(('127.0.0.1', port), TestHTTPRequestHandler)
if not sys.platform.startswith("win"):
# Instantiate a Server(TestHTTPRequestHandler) on a port chosen by the
# runtime.
httpd = make_server(0)
else:
# "Then there's Windows"
# Instantiate a Server(TestHTTPRequestHandler) on the first free port
# in the specified port range.
httpd, port = freeport(range(8000, 8020), make_server)
# Pass the selected port number to the subject test program via the
# environment. We don't want to impose requirements on the test program's
# command-line parsing -- and anyway, for C++ integration tests, that's
# performed in TUT code rather than our own.
os.environ["PORT"] = str(httpd.server_port)
debug("$PORT = %s", httpd.server_port)
sys.exit(run(server_inst=httpd, *sys.argv[1:]))
# @file build_win32_appConfig.py
# @brief Create the windows app.config file to redirect crt linkage.
#
# $LicenseInfo:firstyear=2009&license=viewerlgpl$
# Second Life Viewer Source Code
# Copyright (C) 2010, Linden Research, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License only.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
# $/LicenseInfo$
import sys, os, re
from xml.dom.minidom import parse
def munge_binding_redirect_version(src_manifest_name, src_config_name, dst_config_name):
manifest_dom = parse(src_manifest_name)
node = manifest_dom.getElementsByTagName('assemblyIdentity')[0]
manifest_assm_ver = node.getAttribute('version')
config_dom = parse(src_config_name)
node = config_dom.getElementsByTagName('bindingRedirect')[0]
node.setAttribute('newVersion', manifest_assm_ver)
src_old_ver = re.match(r'([^-]*-).*', node.getAttribute('oldVersion')).group(1)
node.setAttribute('oldVersion', src_old_ver + manifest_assm_ver)
comment = config_dom.createComment("This file is automatically generated by the build. see indra/newview/build_win32_appConfig.py")
config_dom.insertBefore(comment, config_dom.childNodes[0])
print("Writing: " + dst_config_name)
f = open(dst_config_name, 'w')
config_dom.writexml(f)
f.close()
def main():
config = sys.argv[1]
src_dir = sys.argv[2]
dst_dir = sys.argv[3]
dst_name = sys.argv[4]
if config.lower() == 'debug':
src_manifest_name = dst_dir + '/Microsoft.VC80.DebugCRT.manifest'
src_config_name = src_dir + '/SecondLifeDebug.exe.config'
else:
src_manifest_name = dst_dir + '/Microsoft.VC80.CRT.manifest'
src_config_name = src_dir + '/SecondLife.exe.config'
dst_config_name = dst_dir + '/' + dst_name
munge_binding_redirect_version(src_manifest_name, src_config_name, dst_config_name)
return 0
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment