From: david-sarah Date: Sun, 26 Dec 2010 04:02:37 +0000 (-0800) Subject: Remove unmaintained Windows GUI app, except for windows/tahoesvc.py which is moved... X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/?a=commitdiff_plain;h=3132c9b593a6664b2ba3a26c8b8f2b94330cc607;p=tahoe-lafs%2Ftahoe-lafs.git Remove unmaintained Windows GUI app, except for windows/tahoesvc.py which is moved to src/allmydata/windows. refs #1282 --- diff --git a/Makefile b/Makefile index 9d1f02a0..c02b81a4 100644 --- a/Makefile +++ b/Makefile @@ -416,16 +416,3 @@ deb-jaunty-head: .PHONY: EXPERIMENTAL-deb EXPERIMENTAL-deb: is-known-debian-arch $(PYTHON) misc/build_helpers/build-deb.py $(ARCH) - - -# These targets provide for windows native builds -.PHONY: windows-exe windows-installer windows-installer-upload - -windows-exe: .built - $(RUNPP) -c "$(MAKE) -C windows windows-exe" - -windows-installer: - $(RUNPP) -c "$(MAKE) -C windows windows-installer" - -windows-installer-upload: - $(RUNPP) -c "$(MAKE) -C windows windows-installer-upload" diff --git a/src/allmydata/windows/tahoesvc.py b/src/allmydata/windows/tahoesvc.py new file mode 100644 index 00000000..a2b5392a --- /dev/null +++ b/src/allmydata/windows/tahoesvc.py @@ -0,0 +1,163 @@ +import sys +reload(sys) +sys.setdefaultencoding("utf-8") + +import win32serviceutil +import win32service +import win32event +import win32evtlogutil + +import os +import thread +import time +import traceback + +# this logging should go away once service startup is considered debugged. +logfilehandle = file('c:\\tahoe_service.log', 'ab+') +def logmsg(msg): + logfilehandle.write("%s: %s\r\n" % (time.strftime('%Y%m%d_%H%M%S'), msg)) + logfilehandle.flush() +logmsg('service loaded') + +# +# Now with some bootstrap util functions in place, let's try and init things: +try: + from allmydata.util import pkgresutil # override pkg_resources zip provider for py2exe deployment + pkgresutil.install() # this is done before nevow is imported + + logmsg('loading base dir') + from allmydata.windows import registry + basedir = registry.get_base_dir_path() + logmsg("got base dir (%s)" % (basedir,)) + if not basedir: + regpth = "%s : %s " % (registry._AMD_KEY, registry._BDIR_KEY) + raise RuntimeError('"%s" not set in registry' % (regpth,)) + os.chdir(basedir) + logmsg("chdir(%s)" % (basedir,)) +except: + logmsg("exception") + traceback.print_exc(None, logfilehandle) + logfilehandle.flush() + logfilehandle.close() + raise + +class Tahoe(win32serviceutil.ServiceFramework): + _svc_name_ = "Tahoe" + _svc_display_name_ = "Allmydata Tahoe Node" + def __init__(self, args): + logmsg("init") + try: + # The exe-file has messages for the Event Log Viewer. + # Register the exe-file as event source. + # + # Probably it would be better if this is done at installation time, + # so that it also could be removed if the service is uninstalled. + # Unfortunately it cannot be done in the 'if __name__ == "__main__"' + # block below, because the 'frozen' exe-file does not run this code. + # + logmsg("service start") + win32evtlogutil.AddSourceToRegistry(self._svc_display_name_, + sys.executable, + "Application") + win32serviceutil.ServiceFramework.__init__(self, args) + self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) + except: + try: + logmsg("exception") + traceback.print_exc(None, logfilehandle) + logfilehandle.flush() + logfilehandle.close() + except: + os.abort() + + def SvcStop(self): + logmsg("service stop") + self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) + win32event.SetEvent(self.hWaitStop) + + def SvcDoRun(self): + try: + logmsg("service run") + import servicemanager + # Write a 'started' event to the event log... + win32evtlogutil.ReportEvent(self._svc_display_name_, + servicemanager.PYS_SERVICE_STARTED, + 0, # category + servicemanager.EVENTLOG_INFORMATION_TYPE, + (self._svc_name_, '')) + + reactor_type = registry.get_registry_value('reactor') + if reactor_type == 'iocp': + from twisted.internet import iocpreactor + iocpreactor.install() + else: + from twisted.internet import selectreactor + selectreactor.install() + from twisted.internet import reactor + + if os.path.exists('DISABLE_STARTUP'): + logmsg("DISABLE_STARTUP exists: exiting") + else: + logmsg("runing reactorthread") + + # launch main thread... + thread.start_new_thread(self.launch_node, ()) + + # ...and block until service stop request + win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) + + logmsg("wake up") + + reactor.callFromThread(reactor.stop) + + time.sleep(2) # give the node/reactor a chance to cleanup + + # and write a 'stopped' event to the event log. + win32evtlogutil.ReportEvent(self._svc_display_name_, + servicemanager.PYS_SERVICE_STOPPED, + 0, # category + servicemanager.EVENTLOG_INFORMATION_TYPE, + (self._svc_name_, '')) + except: + try: + logmsg("exception") + traceback.print_exc(None, logfilehandle) + logfilehandle.flush() + logfilehandle.close() + except: + os.abort() + + def launch_node(self): + try: + logmsg("main thread startup") + + import depends # import dependencies so that py2exe finds them + _junk = depends # appease pyflakes + + from twisted.internet import reactor + from twisted.python import log, logfile + from allmydata import client + + # set up twisted logging. this will become part of the node rsn. + logdir = os.path.join(basedir, 'logs') + if not os.path.exists(logdir): + os.makedirs(logdir) + lf = logfile.LogFile('tahoesvc.log', logdir) + log.startLogging(lf) + + # run the node itself + c = client.Client(basedir) + reactor.callLater(0, c.startService) # after reactor startup + reactor.run(installSignalHandlers=False) + + logmsg("main thread shutdown") + except: + logmsg("exception") + traceback.print_exc(None, logfilehandle) + logfilehandle.flush() + os.abort() + +if __name__ == '__main__': + logmsg("service main") + win32serviceutil.HandleCommandLine(Tahoe) + diff --git a/windows/Makefile b/windows/Makefile deleted file mode 100644 index 761199c6..00000000 --- a/windows/Makefile +++ /dev/null @@ -1,25 +0,0 @@ - -# we get $(PYTHON) from our parent, do 'make windows-exe PYTHON=foo' to -# control it, since 'PYTHON=foo make windows-exe' doesn't seem to override -# the default. - -# We also get $(PYTHONPATH) from our parent, which is critical for py2exe to -# find the tahoe code. Invoking this Makefile directly won't work. - -INNOSETUP := $(shell cygpath -au "$(PROGRAMFILES)/Inno Setup 5/Compil32.exe") - -.PHONY: windows-exe windows-installer windows-installer-upload - -windows-exe.stamp: - $(PYTHON) setup.py py2exe - touch windows-exe.stamp -windows-exe: windows-exe.stamp - -windows-installer: windows-exe.stamp - $(PYTHON) ../misc/sub-ver.py installer.tmpl >installer.iss - "$(INNOSETUP)" /cc installer.iss - -windows-installer-upload: - chmod -R o+rx dist/installer - rsync -av -e /usr/bin/ssh dist/installer/ amduser@dev:/home/amduser/public_html/dist/tahoe/windows/ - diff --git a/windows/amdicon.ico b/windows/amdicon.ico deleted file mode 100644 index 616240ad..00000000 Binary files a/windows/amdicon.ico and /dev/null differ diff --git a/windows/confwiz.py b/windows/confwiz.py deleted file mode 100644 index 3a88caff..00000000 --- a/windows/confwiz.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys -from allmydata.gui.confwiz import main - -if __name__ == '__main__': -# main(sys.argv, open_welcome_page=False) - main(sys.argv) diff --git a/windows/depends.py b/windows/depends.py deleted file mode 100644 index 97e82d97..00000000 --- a/windows/depends.py +++ /dev/null @@ -1,16 +0,0 @@ - -# nevow requires all these for its voodoo module import time adaptor registrations -from nevow import accessors, appserver, static, rend, url, util, query, i18n, flat -from nevow import guard, stan, testutil, context -from nevow.flat import flatmdom, flatstan, twist -from formless import webform, processors, annotate, iformless -from decimal import Decimal - -import allmydata.web - -# junk to appease pyflakes's outrage at py2exe's needs -junk = [ - accessors, appserver, static, rend, url, util, query, i18n, flat, guard, stan, testutil, - context, flatmdom, flatstan, twist, webform, processors, annotate, iformless, Decimal, - allmydata, - ] diff --git a/windows/installer.bmp b/windows/installer.bmp deleted file mode 100644 index 2e7c24ed..00000000 Binary files a/windows/installer.bmp and /dev/null differ diff --git a/windows/installer.ico b/windows/installer.ico deleted file mode 100644 index aa0f5cb0..00000000 Binary files a/windows/installer.ico and /dev/null differ diff --git a/windows/installer.tmpl b/windows/installer.tmpl deleted file mode 100644 index 6721ed99..00000000 --- a/windows/installer.tmpl +++ /dev/null @@ -1,72 +0,0 @@ -[Setup] -AppName=Allmydata 3.0.4 -; AppVerName=Allmydata 3.0.4 (build %(major)d.%(minor)d.%(point)d-r%(revision)d) -AppVerName=Allmydata 3.0.4 -AppVersion=%(major)d.%(minor)d.%(point)d-r%(revision)d -VersionInfoVersion=%(major)d.%(minor)d.%(point)d.%(revision)d -AppPublisher=Allmydata Inc. -AppCopyright=Copyright (c) 2004-2008 Allmydata, Inc. -AppPublisherURL=http://www.allmydata.com/ -AppSupportURL=http://support.allmydata.com/ -WizardSmallImageFile=../installer.bmp -DefaultDirName={pf}\Allmydata 3.0 -DefaultGroupName=Allmydata 3.0 -; minumum version NT 4, no classic windows -MinVersion=0,4.0 -Compression=lzma/max -SolidCompression=yes -OutputDir=./installer/ -SourceDir=dist -SetupIconFile=../installer.ico -UninstallDisplayIcon=../amdicon.ico -; license file needs to be build/all dir -;LicenseFile=../license.txt -OutputBaseFilename=Allmydata_Tahoe_Setup_v%(major)d_%(minor)d_%(point)d_r%(revision)d - -[Files] -; contents of 'binaries' dir. (consolidated build target) -Source: "*.*"; DestDir: "{app}\Install"; Flags: restartreplace replacesameversion uninsrestartdelete -Source: ".\pkg_resources\*.*"; DestDir: "{app}\Install\pkg_resources"; Flags: recursesubdirs -Source: ".\winfuse\*.*"; DestDir: "{app}\Install\winfuse"; Flags: recursesubdirs - -[Dirs] -Name: "{app}\noderoot" - -[Icons] -; Program files entries -Name: "{group}\Allmydata"; Filename: "{app}\Install\winfuse\AllmydataTray.exe" -Name: "{commonstartup}\Allmydata"; Filename: "{app}\Install\winfuse\AllmydataTray.exe" -;Name: "{group}\Tahoe root dir (web)"; Filename: "{app}\Install\tahoe.exe"; Parameters: "webopen" -Name: "{group}\Allmydata Help"; Filename: "http://www.allmydata.com/help" - -[Run] -; Things performed before the final page of the installer -Filename: "{sys}\net.exe"; Parameters: "stop ""Allmydata SMB"""; Flags: runhidden -Filename: "{sys}\net.exe"; Parameters: "stop Tahoe"; Flags: runhidden -Filename: "{sys}\net.exe"; Parameters: "stop Allmydata Manager"; Flags: runhidden -Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-install -auto"; Flags: runhidden -Filename: "{app}\Install\tahoe.exe"; Parameters: "create-node ""{app}\noderoot"""; Flags: runhidden -Filename: "{app}\Install\winfuse\AllmydataManager.exe"; Parameters: "-install -auto"; Flags: runhidden -Filename: "{app}\Install\winfuse\InstallUtil.exe"; Parameters: """{app}\Install\winfuse\WinFUSE.exe"""; Flags: runhidden -Filename: "{app}\Install\confwiz.exe"; Flags: hidewizard -;Filename: "{app}\Install\ReadMe.txt"; Description: "View the ReadMe file"; Flags: unchecked postinstall nowait shellexec skipifdoesntexist -Filename: "{sys}\rundll32.exe"; Parameters: "{app}\Install\winfuse\loopback_install.dll doLoopBackEntry"; Flags: runhidden -Filename: "{app}\Install\winfuse\AllmydataTray.exe"; Description: "Run Allmydata"; Flags: postinstall nowait -Filename: "http://www.allmydata.com/welcome_install?v=%(major)d.%(minor)d.%(point)d.%(revision)d"; Description: "View the Welcome Page"; Flags: postinstall shellexec -Filename: "{sys}\net.exe"; Parameters: "start ""Allmydata Manager"""; Flags: runhidden - -[UninstallRun] -; Performed before the uninstaller runs to undo things -; xFilename: "{app}\Install\winfuse\AllmydataTray.exe"; Parameters: "-Q"; Flags: runhidden -Filename: "{sys}\net.exe"; Parameters: "stop ""Allmydata SMB"""; Flags: runhidden -Filename: "{sys}\net.exe"; Parameters: "stop Tahoe"; Flags: runhidden -Filename: "{sys}\net.exe"; Parameters: "stop ""Allmydata Manager"""; Flags: runhidden -Filename: "{app}\Install\winfuse\InstallUtil.exe"; Parameters: "/uninstall ""{app}\Install\winfuse\WinFUSE.exe"""; Flags: runhidden -Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-remove"; Flags: runhidden -Filename: "{app}\Install\winfuse\AllmydataManager.exe"; Parameters: "-U"; Flags: runhidden -;Filename: "{app}\Install\confwiz.exe"; Parameters: "--uninstall"; Flags: runhidden -;Filename: "http://www.allmydata.com/redirect/uninstallsurvey.php?build=%(build)s"; Flags: shellexec - -[Registry] -Root: HKLM; Subkey: "Software\Allmydata"; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: "Software\Allmydata"; ValueType: string; ValueName: "Base Dir Path"; ValueData: "{app}\noderoot"; Flags: uninsdeletekey diff --git a/windows/setup.py b/windows/setup.py deleted file mode 100644 index 62e5e71e..00000000 --- a/windows/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -from distutils.core import setup -import py2exe - -import glob - -lnf_manifest = """ - - - -%s - - - - - - -""" - -packages = ['encodings'] - -try: - import _xmlplus -except ImportError: - pass -else: - packages.append('_xmlplus') - -setup_args = { - 'name': 'Tahoe', - 'description': 'Allmydata Tahoe distributated storage', - 'author': 'Allmydata, Inc.', - 'windows': [ - { - 'script': 'confwiz.py', - 'icon_resources': [(1, 'amdicon.ico')], - 'other_resources': [(24,1,lnf_manifest%'Allmydata Tahoe Config Wizard')], - }, - ], - 'console': [ - 'tahoe.py', - ], - 'service': [ - 'tahoesvc', - ], - 'data_files': [ - ('.', [ - ],), - ('pkg_resources/allmydata/web', glob.glob('../src/allmydata/web/*')), - ('winfuse', glob.glob('./winfuse/*')), - ], - 'zipfile' : 'library.zip', - 'options': { - "py2exe": { - "excludes": [ - ], - "includes": [ - ], - "packages": packages, - #"optimize" : 2, - }, - }, -} - -if __name__ == '__main__': - setup(**setup_args) - - -_junk = py2exe # appease pyflakes -del _junk diff --git a/windows/tahoe.py b/windows/tahoe.py deleted file mode 100644 index e3e4b469..00000000 --- a/windows/tahoe.py +++ /dev/null @@ -1,9 +0,0 @@ -from allmydata.util import pkgresutil # override the pkg_resources zip provider for py2exe deployment -pkgresutil.install() # this is done before nevow is imported by depends -import depends # import dependencies so that py2exe finds them -_junk = depends # appease pyflakes - -import sys -from allmydata.scripts import runner - -sys.exit(runner(install_node_control=False)) \ No newline at end of file diff --git a/windows/tahoesvc.py b/windows/tahoesvc.py deleted file mode 100644 index a2b5392a..00000000 --- a/windows/tahoesvc.py +++ /dev/null @@ -1,163 +0,0 @@ -import sys -reload(sys) -sys.setdefaultencoding("utf-8") - -import win32serviceutil -import win32service -import win32event -import win32evtlogutil - -import os -import thread -import time -import traceback - -# this logging should go away once service startup is considered debugged. -logfilehandle = file('c:\\tahoe_service.log', 'ab+') -def logmsg(msg): - logfilehandle.write("%s: %s\r\n" % (time.strftime('%Y%m%d_%H%M%S'), msg)) - logfilehandle.flush() -logmsg('service loaded') - -# -# Now with some bootstrap util functions in place, let's try and init things: -try: - from allmydata.util import pkgresutil # override pkg_resources zip provider for py2exe deployment - pkgresutil.install() # this is done before nevow is imported - - logmsg('loading base dir') - from allmydata.windows import registry - basedir = registry.get_base_dir_path() - logmsg("got base dir (%s)" % (basedir,)) - if not basedir: - regpth = "%s : %s " % (registry._AMD_KEY, registry._BDIR_KEY) - raise RuntimeError('"%s" not set in registry' % (regpth,)) - os.chdir(basedir) - logmsg("chdir(%s)" % (basedir,)) -except: - logmsg("exception") - traceback.print_exc(None, logfilehandle) - logfilehandle.flush() - logfilehandle.close() - raise - -class Tahoe(win32serviceutil.ServiceFramework): - _svc_name_ = "Tahoe" - _svc_display_name_ = "Allmydata Tahoe Node" - def __init__(self, args): - logmsg("init") - try: - # The exe-file has messages for the Event Log Viewer. - # Register the exe-file as event source. - # - # Probably it would be better if this is done at installation time, - # so that it also could be removed if the service is uninstalled. - # Unfortunately it cannot be done in the 'if __name__ == "__main__"' - # block below, because the 'frozen' exe-file does not run this code. - # - logmsg("service start") - win32evtlogutil.AddSourceToRegistry(self._svc_display_name_, - sys.executable, - "Application") - win32serviceutil.ServiceFramework.__init__(self, args) - self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) - except: - try: - logmsg("exception") - traceback.print_exc(None, logfilehandle) - logfilehandle.flush() - logfilehandle.close() - except: - os.abort() - - def SvcStop(self): - logmsg("service stop") - self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) - win32event.SetEvent(self.hWaitStop) - - def SvcDoRun(self): - try: - logmsg("service run") - import servicemanager - # Write a 'started' event to the event log... - win32evtlogutil.ReportEvent(self._svc_display_name_, - servicemanager.PYS_SERVICE_STARTED, - 0, # category - servicemanager.EVENTLOG_INFORMATION_TYPE, - (self._svc_name_, '')) - - reactor_type = registry.get_registry_value('reactor') - if reactor_type == 'iocp': - from twisted.internet import iocpreactor - iocpreactor.install() - else: - from twisted.internet import selectreactor - selectreactor.install() - from twisted.internet import reactor - - if os.path.exists('DISABLE_STARTUP'): - logmsg("DISABLE_STARTUP exists: exiting") - else: - logmsg("runing reactorthread") - - # launch main thread... - thread.start_new_thread(self.launch_node, ()) - - # ...and block until service stop request - win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) - - logmsg("wake up") - - reactor.callFromThread(reactor.stop) - - time.sleep(2) # give the node/reactor a chance to cleanup - - # and write a 'stopped' event to the event log. - win32evtlogutil.ReportEvent(self._svc_display_name_, - servicemanager.PYS_SERVICE_STOPPED, - 0, # category - servicemanager.EVENTLOG_INFORMATION_TYPE, - (self._svc_name_, '')) - except: - try: - logmsg("exception") - traceback.print_exc(None, logfilehandle) - logfilehandle.flush() - logfilehandle.close() - except: - os.abort() - - def launch_node(self): - try: - logmsg("main thread startup") - - import depends # import dependencies so that py2exe finds them - _junk = depends # appease pyflakes - - from twisted.internet import reactor - from twisted.python import log, logfile - from allmydata import client - - # set up twisted logging. this will become part of the node rsn. - logdir = os.path.join(basedir, 'logs') - if not os.path.exists(logdir): - os.makedirs(logdir) - lf = logfile.LogFile('tahoesvc.log', logdir) - log.startLogging(lf) - - # run the node itself - c = client.Client(basedir) - reactor.callLater(0, c.startService) # after reactor startup - reactor.run(installSignalHandlers=False) - - logmsg("main thread shutdown") - except: - logmsg("exception") - traceback.print_exc(None, logfilehandle) - logfilehandle.flush() - os.abort() - -if __name__ == '__main__': - logmsg("service main") - win32serviceutil.HandleCommandLine(Tahoe) -