If you just want to install the mod, click here for the installer download page.
This repository contains the mod installer, used for installing all 07th-mod mods. The installer is cross-platform and written in python.
The below information is for developers only.
The HTML for the landing page and update banners for each mod is dynamically fetched from this github repo https://github.com/07th-mod/python-patcher-updates.
To update the html:
Currently only the landing page and Hou+ implement this updateable html function.
More detail is available in the Readme.md
page on that repo.
If you have no preference for IDE, I would recommend Pycharm
as it will help reduce mistakes while you're writing your code. Please conform to the follwing guidelines:
Please use tabs, not spaces, when editing the python code, and enable smart tabs if your editor supports them.
Ensure your code can run under both Python 2 and 3. We are currently supporting Python 2 only for MacOS - we may remove this requirement in the future.
Please note that pycharm will attempt to index files in the project folder - this may cause problems when you run the installer from pycharm, as the installer may try to move a file Pycharm is currently reading, causing it to fail (I have only seen this happen once).
If the installer is stopped using the "Quit Installer" button while a download is in progress, aria2c will keep downloading in the background (at least on Windows). Normally when running the installer on Windows, the launcher will terminate the aria2c process using a Windows Job Object, but when running through an IDE this won't happen.
Force closing the script via the IDE does seem to kill the aria2c process, however.
The patcher reads the file installData.json to figure out what mods are available. The spec for this file is defined as a Codable
Swift struct in JSONValidator.swift
The validator will run automatically on every push, to check the installData.json
is correctly formatted. Because the validator is quite strict, the validator will need to be updated if the installData.json
format is changed.
The installer has a global variable called DEVELOPER_MODE, which controls how it behaves. Developer mode will be activated if an installData.json
is found on disk adjacent to the install script. This will be the case if you clone the git repository, then run the script.
In developer mode, the installer will prefer local files (on disk) if they are present, instead of remote files (from github). This mode will Specifically:
installData.json
cachedDownloadSizes.json
The Github repository contains a file called cachedDownloadSizes.json
to allow the installer to calculate the size of a mod without having to query each download link. When the installer runs in normal mode, it downloads this file from Github each time the installer is run.
When the installer is run in developer mode, it checks that all URLs in installData.json
are present in cachedDownloadSizes.json
- if not the cachedDownloadSizes.json
file is automatically regenerated. Please commit this cachedDownloadSizes.json
to the git repository each time it changes.
The web interface component is located in the httpGUI folder.
It is setup as a npm package with eslint
, such that you can install
the eslint
plugin in Visual Studio Code and have code
style checks/syntax checks etc. applied.
To setup the development environment:
npm
(You may want to use nvm
or nvm-windows
to manage npm
versions)visual studio code
eslint
plugin for visual studio code (available in the marketplace)httpGUI
subdirectory, then run npm install
CRLF
, then choose
LF
To use the plugin:
httpGUI
folder, but no syntax highlighting appears, most likely you didn't run npm install
earlier.The installer contains an interactive text mode installer, which can be used by the end user if the graphical installer fails (this is different from the "command line interface").
The installer also ships with an alternative command line interface for advanced users. For instructions, please refer to this section of the wiki.
It is HIGHLY recommended to use a linter when editing Github Actions .yml files - pycharm provides this functionality.
Please read the comments in the .github/workflows/test_and_deploy.yml
file for more information.
The windows loader is not well documented. Please contact one of the dev team members if you have trouble building - it is more than likely there is an error in the instructions below, rather than somethign wrong on your end.
The installer is mostly setup to build on travis - if you want to build locally, you'll need to do the following (WINDOWS ONLY):
7za.exe
(you may need to rename it to 7za.exe
if it is called 7z.exe
), and place it next to travis_build_script.py
(or put 7za on your path)TRAVIS_TAG
environment variable using set TRAVIS_TAG=v9.9.9
python travis_build_script.py win
(make sure to include the win
part), in the same command windowThe built exe will be located in the travis_installer_output
folder