| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | import os | 
					
						
							|  |  |  | import shutil | 
					
						
							|  |  |  | import sys | 
					
						
							|  |  |  | import sysconfig | 
					
						
							|  |  |  | from pathlib import Path | 
					
						
							| 
									
										
										
										
											2022-01-22 20:35:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | import ModuleUpdate | 
					
						
							|  |  |  | # I don't really want to have another root directory file for a single requirement, but this special case is also jank. | 
					
						
							|  |  |  | # Might move this into a cleaner solution when I think of one. | 
					
						
							|  |  |  | with open("freeze_requirements.txt", "w") as f: | 
					
						
							|  |  |  |     f.write("cx-Freeze>=6.9\n") | 
					
						
							|  |  |  | ModuleUpdate.requirements_files.add("freeze_requirements.txt") | 
					
						
							|  |  |  | ModuleUpdate.requirements_files.add(os.path.join("WebHostLib", "requirements.txt")) | 
					
						
							|  |  |  | ModuleUpdate.update() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | import cx_Freeze | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  | from kivy_deps import sdl2, glew | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  | from Utils import version_tuple | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  | arch_folder = "exe.{platform}-{version}".format(platform=sysconfig.get_platform(), | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  |                                                 version=sysconfig.get_python_version()) | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  | buildfolder = Path("build", arch_folder) | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | sbuildfolder = str(buildfolder) | 
					
						
							|  |  |  | libfolder = Path(buildfolder, "lib") | 
					
						
							|  |  |  | library = Path(libfolder, "library.zip") | 
					
						
							| 
									
										
										
										
											2020-12-06 14:36:14 +01:00
										 |  |  | print("Outputting to: " + sbuildfolder) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-21 09:18:28 +02:00
										 |  |  | icon = os.path.join("data", "icon.ico") | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  | mcicon = os.path.join("data", "mcicon.ico") | 
					
						
							| 
									
										
										
										
											2020-05-01 18:51:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | if os.path.exists("X:/pw.txt"): | 
					
						
							|  |  |  |     print("Using signtool") | 
					
						
							|  |  |  |     with open("X:/pw.txt") as f: | 
					
						
							|  |  |  |         pw = f.read() | 
					
						
							| 
									
										
										
										
											2020-08-24 04:35:32 +02:00
										 |  |  |     signtool = r'signtool sign /f X:/_SITS_Zertifikat_.pfx /p ' + pw + r' /fd sha256 /tr http://timestamp.digicert.com/ ' | 
					
						
							| 
									
										
										
										
											2020-05-01 18:51:08 +02:00
										 |  |  | else: | 
					
						
							|  |  |  |     signtool = None | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | from hashlib import sha3_512 | 
					
						
							|  |  |  | import base64 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 14:36:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | def _threaded_hash(filepath): | 
					
						
							|  |  |  |     hasher = sha3_512() | 
					
						
							|  |  |  |     hasher.update(open(filepath, "rb").read()) | 
					
						
							|  |  |  |     return base64.b85encode(hasher.digest()).decode() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 14:36:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | os.makedirs(buildfolder, exist_ok=True) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 14:36:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  | def manifest_creation(folder, create_hashes=False): | 
					
						
							|  |  |  |     # Since the setup is now split into components and the manifest is not, | 
					
						
							|  |  |  |     # it makes most sense to just remove the hashes for now. Not aware of anyone using them. | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     hashes = {} | 
					
						
							| 
									
										
										
										
											2021-05-27 12:26:08 +02:00
										 |  |  |     manifestpath = os.path.join(folder, "manifest.json") | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  |     if create_hashes: | 
					
						
							|  |  |  |         from concurrent.futures import ThreadPoolExecutor | 
					
						
							|  |  |  |         pool = ThreadPoolExecutor() | 
					
						
							|  |  |  |         for dirpath, dirnames, filenames in os.walk(folder): | 
					
						
							|  |  |  |             for filename in filenames: | 
					
						
							|  |  |  |                 path = os.path.join(dirpath, filename) | 
					
						
							|  |  |  |                 hashes[os.path.relpath(path, start=folder)] = pool.submit(_threaded_hash, path) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     import json | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  |     manifest = { | 
					
						
							|  |  |  |         "buildtime": buildtime.isoformat(sep=" ", timespec="seconds"), | 
					
						
							|  |  |  |         "hashes": {path: hash.result() for path, hash in hashes.items()}, | 
					
						
							|  |  |  |         "version": version_tuple} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     json.dump(manifest, open(manifestpath, "wt"), indent=4) | 
					
						
							|  |  |  |     print("Created Manifest") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												WebUI (#100)
* Object-Oriented base changes for web-ui prep
* remove debug raise
* optimize broadcast to serialize once
* Implement WebUI socket, static assets, and classes
- Still need to wrap logging functions and send output to UI
- UI commands are successfully being sent to the server
* GUI operational. Wrap logging functions, implement server address selection on GUI, automatically launch web browser when client websocket is served
* Update MultiServer status when a user disconnects / reconnects
* Implement colored item and hint checks, improve GUI readability
* Fix improper formatting on received items
* Update SNES connection status on disconnect / reconnect. Implement itemFound, prevent accidentally printing JS objects
* Minor text change for itemFound
* Fixed a very wrong comment
* Fixed client commands not working, fixed un-helpful error messages appearing in GUI
* Fix a bug causing a failure to connect to a multiworld server if a previously existing cached address was present and the client was loaded without an address passed in
* Convert WebUI to React /w Redux. WebSocket communications not yet operational.
* WebUI fully converted to React / Redux.
- Websocket communication operational
- Added a button to connect to the multiserver which appears only when a SNES is connected and a server connection is not active
* Restore some features lost in WebUI
- Restore (found) notification on hints if the item has already been obtained
- Restore (x/y) indicator on received items, which indicates the number of items the client is waiting to receive from the client in a queue
* Fix a grammatical UI big causing player names to show only an apostrophe when possessive
* Add support for multiple SNES Devices, and switching between them
* freeze support for client
* make sure flask works when frozen
* UI Improvements
- Hint messages now actually show a found status via ✔ and ❌ emoji
- Active player name is always a different color than other players (orange for now)
- Add a toggle to show only entries relevant to the active player
- Added a WidgetArea
- Added a notes widget
* Received items now marked as relevant
* Include production build for deployment
* Notes now survive a browser close. Minimum width applied to monitor to prevent CSS issues.
* include webUi folder in setup.py
* Bugfixes for Monitor
- Fix a bug causing the monitor window to grow beyond it's intended content limit
- Reduced monitor content limit to 200 items
- Ensured each monitor entry has a unique key
* Prevent eslint from yelling at me about stupid things
* Add button to collapse sidebar, press enter on empty server input to disconnect on purpose
* WebUI is now aware of client disconnect, message log limit increased to 350, fix !missing output
* Update WebUI to v2.2.1
- Added color to WebUI for entrance-span
- Make !missing show total count at bottom of list to match /missing behavior
* Fix a bug causing clients version <= 2.2.0 to crash when anyone asks for a hint
- Also fix a bug in the WebUI causing the entrance location to always show as "somewhere"
* Update WebUI color palette (this cost me $50)
* allow text console input alongside web-ui
* remove Flask
a bit overkill for what we're doing
* remove jinja2
* Update WebUI to work with new hosting mechanism
* with flask gone, we no longer need subprocess shenanigans
* If multiple web ui clients try to run, at least present a working console
* Update MultiClient and WebUI to handle multiple clients simultaneously.
- The port on which the websocket for the WebUI is hosted is not chosen randomly from 5000 - 5999. This port is passed to the browser so it knows which MultiClient to connect to
- Removed failure condition if a web server is already running, as there is no need to run more than one web server on a single system. If an exception is thrown while attempting to launch a web server, a check is made for the port being unavailable. If the port is unavailable, it probably means the user is launching a second MultiClient. A web browser is then opened with a connection to the correct webui_socket_port.
- Add a /web command to the MultiClient to repoen the appropriate browser window and get params in case a user accidentally closes the tab
* Use proper name for WebUI
* move webui into /data with other data files
* make web ui optional
This is mostly for laptop users wanting to preserve some battery, should not be needed outside of that.
* fix direct server start
* re-add connection timer
* fix indentation
Co-authored-by: Chris <chris@legendserver.info>
											
										 
											2020-06-03 21:29:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  | def remove_sprites_from_folder(folder): | 
					
						
							|  |  |  |     for file in os.listdir(folder): | 
					
						
							|  |  |  |         if file != ".gitignore": | 
					
						
							|  |  |  |             os.remove(folder / file) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-21 18:08:15 +02:00
										 |  |  | scripts = { | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |     # Core | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  |     "MultiServer.py": ("ArchipelagoServer", False, icon), | 
					
						
							|  |  |  |     "Generate.py": ("ArchipelagoGenerate", False, icon), | 
					
						
							| 
									
										
										
										
											2021-09-30 09:09:21 +02:00
										 |  |  |     "CommonClient.py": ("ArchipelagoTextClient", True, icon), | 
					
						
							| 
									
										
										
										
											2021-11-12 08:00:11 -05:00
										 |  |  |     # SNI | 
					
						
							|  |  |  |     "SNIClient.py": ("ArchipelagoSNIClient", True, icon), | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  |     "LttPAdjuster.py": ("ArchipelagoLttPAdjuster", True, icon), | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |     # Factorio | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  |     "FactorioClient.py": ("ArchipelagoFactorioClient", True, icon), | 
					
						
							| 
									
										
										
										
											2021-08-09 00:46:29 -07:00
										 |  |  |     # Minecraft | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  |     "MinecraftClient.py": ("ArchipelagoMinecraftClient", False, mcicon), | 
					
						
							| 
									
										
										
										
											2021-11-15 08:32:54 -06:00
										 |  |  |     # Ocarina of Time | 
					
						
							|  |  |  |     "OoTAdjuster.py": ("ArchipelagoOoTAdjuster", True, icon), | 
					
						
							| 
									
										
										
										
											2021-11-28 14:32:08 -07:00
										 |  |  |     # FF1 | 
					
						
							|  |  |  |     "FF1Client.py": ("ArchipelagoFF1Client", True, icon), | 
					
						
							| 
									
										
										
										
											2021-07-21 18:08:15 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-02-02 22:36:55 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exes = [] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-14 15:21:52 -07:00
										 |  |  | for script, (scriptname, gui, icon) in scripts.items(): | 
					
						
							| 
									
										
										
										
											2020-02-02 22:36:55 +01:00
										 |  |  |     exes.append(cx_Freeze.Executable( | 
					
						
							|  |  |  |         script=script, | 
					
						
							| 
									
										
										
										
											2021-04-27 05:26:27 +02:00
										 |  |  |         target_name=scriptname + ("" if sys.platform == "linux" else ".exe"), | 
					
						
							| 
									
										
											  
											
												WebUI (#100)
* Object-Oriented base changes for web-ui prep
* remove debug raise
* optimize broadcast to serialize once
* Implement WebUI socket, static assets, and classes
- Still need to wrap logging functions and send output to UI
- UI commands are successfully being sent to the server
* GUI operational. Wrap logging functions, implement server address selection on GUI, automatically launch web browser when client websocket is served
* Update MultiServer status when a user disconnects / reconnects
* Implement colored item and hint checks, improve GUI readability
* Fix improper formatting on received items
* Update SNES connection status on disconnect / reconnect. Implement itemFound, prevent accidentally printing JS objects
* Minor text change for itemFound
* Fixed a very wrong comment
* Fixed client commands not working, fixed un-helpful error messages appearing in GUI
* Fix a bug causing a failure to connect to a multiworld server if a previously existing cached address was present and the client was loaded without an address passed in
* Convert WebUI to React /w Redux. WebSocket communications not yet operational.
* WebUI fully converted to React / Redux.
- Websocket communication operational
- Added a button to connect to the multiserver which appears only when a SNES is connected and a server connection is not active
* Restore some features lost in WebUI
- Restore (found) notification on hints if the item has already been obtained
- Restore (x/y) indicator on received items, which indicates the number of items the client is waiting to receive from the client in a queue
* Fix a grammatical UI big causing player names to show only an apostrophe when possessive
* Add support for multiple SNES Devices, and switching between them
* freeze support for client
* make sure flask works when frozen
* UI Improvements
- Hint messages now actually show a found status via ✔ and ❌ emoji
- Active player name is always a different color than other players (orange for now)
- Add a toggle to show only entries relevant to the active player
- Added a WidgetArea
- Added a notes widget
* Received items now marked as relevant
* Include production build for deployment
* Notes now survive a browser close. Minimum width applied to monitor to prevent CSS issues.
* include webUi folder in setup.py
* Bugfixes for Monitor
- Fix a bug causing the monitor window to grow beyond it's intended content limit
- Reduced monitor content limit to 200 items
- Ensured each monitor entry has a unique key
* Prevent eslint from yelling at me about stupid things
* Add button to collapse sidebar, press enter on empty server input to disconnect on purpose
* WebUI is now aware of client disconnect, message log limit increased to 350, fix !missing output
* Update WebUI to v2.2.1
- Added color to WebUI for entrance-span
- Make !missing show total count at bottom of list to match /missing behavior
* Fix a bug causing clients version <= 2.2.0 to crash when anyone asks for a hint
- Also fix a bug in the WebUI causing the entrance location to always show as "somewhere"
* Update WebUI color palette (this cost me $50)
* allow text console input alongside web-ui
* remove Flask
a bit overkill for what we're doing
* remove jinja2
* Update WebUI to work with new hosting mechanism
* with flask gone, we no longer need subprocess shenanigans
* If multiple web ui clients try to run, at least present a working console
* Update MultiClient and WebUI to handle multiple clients simultaneously.
- The port on which the websocket for the WebUI is hosted is not chosen randomly from 5000 - 5999. This port is passed to the browser so it knows which MultiClient to connect to
- Removed failure condition if a web server is already running, as there is no need to run more than one web server on a single system. If an exception is thrown while attempting to launch a web server, a check is made for the port being unavailable. If the port is unavailable, it probably means the user is launching a second MultiClient. A web browser is then opened with a connection to the correct webui_socket_port.
- Add a /web command to the MultiClient to repoen the appropriate browser window and get params in case a user accidentally closes the tab
* Use proper name for WebUI
* move webui into /data with other data files
* make web ui optional
This is mostly for laptop users wanting to preserve some battery, should not be needed outside of that.
* fix direct server start
* re-add connection timer
* fix indentation
Co-authored-by: Chris <chris@legendserver.info>
											
										 
											2020-06-03 21:29:43 +02:00
										 |  |  |         icon=icon, | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |         base="Win32GUI" if sys.platform == "win32" and gui else None | 
					
						
							| 
									
										
											  
											
												WebUI (#100)
* Object-Oriented base changes for web-ui prep
* remove debug raise
* optimize broadcast to serialize once
* Implement WebUI socket, static assets, and classes
- Still need to wrap logging functions and send output to UI
- UI commands are successfully being sent to the server
* GUI operational. Wrap logging functions, implement server address selection on GUI, automatically launch web browser when client websocket is served
* Update MultiServer status when a user disconnects / reconnects
* Implement colored item and hint checks, improve GUI readability
* Fix improper formatting on received items
* Update SNES connection status on disconnect / reconnect. Implement itemFound, prevent accidentally printing JS objects
* Minor text change for itemFound
* Fixed a very wrong comment
* Fixed client commands not working, fixed un-helpful error messages appearing in GUI
* Fix a bug causing a failure to connect to a multiworld server if a previously existing cached address was present and the client was loaded without an address passed in
* Convert WebUI to React /w Redux. WebSocket communications not yet operational.
* WebUI fully converted to React / Redux.
- Websocket communication operational
- Added a button to connect to the multiserver which appears only when a SNES is connected and a server connection is not active
* Restore some features lost in WebUI
- Restore (found) notification on hints if the item has already been obtained
- Restore (x/y) indicator on received items, which indicates the number of items the client is waiting to receive from the client in a queue
* Fix a grammatical UI big causing player names to show only an apostrophe when possessive
* Add support for multiple SNES Devices, and switching between them
* freeze support for client
* make sure flask works when frozen
* UI Improvements
- Hint messages now actually show a found status via ✔ and ❌ emoji
- Active player name is always a different color than other players (orange for now)
- Add a toggle to show only entries relevant to the active player
- Added a WidgetArea
- Added a notes widget
* Received items now marked as relevant
* Include production build for deployment
* Notes now survive a browser close. Minimum width applied to monitor to prevent CSS issues.
* include webUi folder in setup.py
* Bugfixes for Monitor
- Fix a bug causing the monitor window to grow beyond it's intended content limit
- Reduced monitor content limit to 200 items
- Ensured each monitor entry has a unique key
* Prevent eslint from yelling at me about stupid things
* Add button to collapse sidebar, press enter on empty server input to disconnect on purpose
* WebUI is now aware of client disconnect, message log limit increased to 350, fix !missing output
* Update WebUI to v2.2.1
- Added color to WebUI for entrance-span
- Make !missing show total count at bottom of list to match /missing behavior
* Fix a bug causing clients version <= 2.2.0 to crash when anyone asks for a hint
- Also fix a bug in the WebUI causing the entrance location to always show as "somewhere"
* Update WebUI color palette (this cost me $50)
* allow text console input alongside web-ui
* remove Flask
a bit overkill for what we're doing
* remove jinja2
* Update WebUI to work with new hosting mechanism
* with flask gone, we no longer need subprocess shenanigans
* If multiple web ui clients try to run, at least present a working console
* Update MultiClient and WebUI to handle multiple clients simultaneously.
- The port on which the websocket for the WebUI is hosted is not chosen randomly from 5000 - 5999. This port is passed to the browser so it knows which MultiClient to connect to
- Removed failure condition if a web server is already running, as there is no need to run more than one web server on a single system. If an exception is thrown while attempting to launch a web server, a check is made for the port being unavailable. If the port is unavailable, it probably means the user is launching a second MultiClient. A web browser is then opened with a connection to the correct webui_socket_port.
- Add a /web command to the MultiClient to repoen the appropriate browser window and get params in case a user accidentally closes the tab
* Use proper name for WebUI
* move webui into /data with other data files
* make web ui optional
This is mostly for laptop users wanting to preserve some battery, should not be needed outside of that.
* fix direct server start
* re-add connection timer
* fix indentation
Co-authored-by: Chris <chris@legendserver.info>
											
										 
											2020-06-03 21:29:43 +02:00
										 |  |  |     )) | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | import datetime | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-09 16:16:31 +02:00
										 |  |  | buildtime = datetime.datetime.utcnow() | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | cx_Freeze.setup( | 
					
						
							| 
									
										
										
										
											2021-01-03 14:32:32 +01:00
										 |  |  |     name="Archipelago", | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  |     version=f"{version_tuple.major}.{version_tuple.minor}.{version_tuple.build}", | 
					
						
							| 
									
										
										
										
											2021-01-03 14:32:32 +01:00
										 |  |  |     description="Archipelago", | 
					
						
							| 
									
										
										
										
											2020-02-02 22:36:55 +01:00
										 |  |  |     executables=exes, | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     options={ | 
					
						
							|  |  |  |         "build_exe": { | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |             "packages": ["websockets", "worlds", "kivy"], | 
					
						
							| 
									
										
										
										
											2020-08-24 04:35:32 +02:00
										 |  |  |             "includes": [], | 
					
						
							| 
									
										
										
										
											2020-09-20 00:34:35 +02:00
										 |  |  |             "excludes": ["numpy", "Cython", "PySide2", "PIL", | 
					
						
							|  |  |  |                          "pandas"], | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |             "zip_include_packages": ["*"], | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |             "zip_exclude_packages": ["worlds", "kivy"], | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |             "include_files": [], | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |             "include_msvcr": False, | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |             "replace_paths": [("*", "")], | 
					
						
							| 
									
										
										
										
											2021-07-28 13:31:27 +02:00
										 |  |  |             "optimize": 1, | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |             "build_exe": buildfolder | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 13:22:47 +02:00
										 |  |  | def installfile(path, keep_content=False): | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     lbuildfolder = buildfolder | 
					
						
							|  |  |  |     print('copying', path, '->', lbuildfolder) | 
					
						
							|  |  |  |     if path.is_dir(): | 
					
						
							|  |  |  |         lbuildfolder /= path.name | 
					
						
							| 
									
										
										
										
											2020-08-25 13:22:47 +02:00
										 |  |  |         if lbuildfolder.is_dir() and not keep_content: | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |             shutil.rmtree(lbuildfolder) | 
					
						
							| 
									
										
										
										
											2020-08-25 13:22:47 +02:00
										 |  |  |         shutil.copytree(path, lbuildfolder, dirs_exist_ok=True) | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  |     elif path.is_file(): | 
					
						
							|  |  |  |         shutil.copy(path, lbuildfolder) | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         print('Warning,', path, 'not found') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-06 19:33:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | for folder in sdl2.dep_bins + glew.dep_bins: | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  |     shutil.copytree(folder, libfolder, dirs_exist_ok=True) | 
					
						
							|  |  |  |     print('copying', folder, '->', libfolder) | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-10 09:29:59 +01:00
										 |  |  | extra_data = ["LICENSE", "data", "EnemizerCLI", "host.yaml", "SNI"] | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | for data in extra_data: | 
					
						
							|  |  |  |     installfile(Path(data)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-03 07:01:43 +01:00
										 |  |  | os.makedirs(buildfolder / "Players" / "Templates", exist_ok=True) | 
					
						
							| 
									
										
										
										
											2021-10-16 19:40:58 +02:00
										 |  |  | from WebHostLib.options import create | 
					
						
							|  |  |  | create() | 
					
						
							|  |  |  | from worlds.AutoWorld import AutoWorldRegister | 
					
						
							|  |  |  | for worldname, worldtype in AutoWorldRegister.world_types.items(): | 
					
						
							|  |  |  |     if not worldtype.hidden: | 
					
						
							|  |  |  |         file_name = worldname+".yaml" | 
					
						
							|  |  |  |         shutil.copyfile(os.path.join("WebHostLib", "static", "generated", "configs", file_name), | 
					
						
							| 
									
										
										
										
											2021-12-03 07:01:43 +01:00
										 |  |  |                         buildfolder / "Players" / "Templates" / file_name) | 
					
						
							| 
									
										
										
										
											2021-12-10 09:29:59 +01:00
										 |  |  | shutil.copyfile("meta.yaml", buildfolder / "Players" / "Templates" / "meta.yaml") | 
					
						
							| 
									
										
										
										
											2020-02-02 06:25:06 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-25 13:27:34 +02:00
										 |  |  | try: | 
					
						
							|  |  |  |     from maseya import z3pr | 
					
						
							|  |  |  | except ImportError: | 
					
						
							|  |  |  |     print("Maseya Palette Shuffle not found, skipping data files.") | 
					
						
							|  |  |  | else: | 
					
						
							|  |  |  |     # maseya Palette Shuffle exists and needs its data files | 
					
						
							|  |  |  |     print("Maseya Palette Shuffle found, including data files...") | 
					
						
							|  |  |  |     file = z3pr.__file__ | 
					
						
							|  |  |  |     installfile(Path(os.path.dirname(file)) / "data", keep_content=True) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 18:51:08 +02:00
										 |  |  | if signtool: | 
					
						
							|  |  |  |     for exe in exes: | 
					
						
							| 
									
										
										
										
											2021-04-25 04:02:38 +02:00
										 |  |  |         print(f"Signing {exe.target_name}") | 
					
						
							|  |  |  |         os.system(signtool + os.path.join(buildfolder, exe.target_name)) | 
					
						
							| 
									
										
										
										
											2021-07-07 03:45:27 +02:00
										 |  |  |     print(f"Signing SNI") | 
					
						
							|  |  |  |     os.system(signtool + os.path.join(buildfolder, "SNI", "SNI.exe")) | 
					
						
							| 
									
										
										
										
											2021-09-04 14:38:34 +02:00
										 |  |  |     print(f"Signing OoT Utils") | 
					
						
							|  |  |  |     for exe_path in (("Compress", "Compress.exe"), ("Decompress", "Decompress.exe")): | 
					
						
							|  |  |  |         os.system(signtool + os.path.join(buildfolder, "lib", "worlds", "oot", "data", *exe_path)) | 
					
						
							| 
									
										
										
										
											2021-05-16 18:30:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-31 00:03:48 +02:00
										 |  |  | remove_sprites_from_folder(buildfolder / "data" / "sprites" / "alttpr") | 
					
						
							| 
									
										
										
										
											2021-05-27 12:26:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | manifest_creation(buildfolder) | 
					
						
							| 
									
										
										
										
											2022-01-21 08:39:42 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | if sys.platform == "win32": | 
					
						
							|  |  |  |     with open("setup.ini", "w") as f: | 
					
						
							|  |  |  |         min_supported_windows = "6.2.9200" if sys.version_info > (3, 9) else "6.0.6000" | 
					
						
							|  |  |  |         f.write(f"[Data]\nsource_path={buildfolder}\nmin_windows={min_supported_windows}\n") |