Alternate Build File Format
Originally #167 (closed)
Opening a new version as it may still be a useful idea to simplify most package files.
My best idea under the current system would be as a data-only format with an inherit
field which uses the other fields to initialise a Pybuild object with the class specified in inherit (e.g. inherit: common.mw:MW
). It would have no real speed benefits, but would make simple packages even simpler.
E.g. (to update the example in #167 (closed), which wasn't even valid yaml):
inherit: common.mw:MW
NAME: "Correct Iron Warhammer"
DESC: "Makes the iron warhammers look more like how the game describes them"
HOMEPAGE: "https://www.nexusmods.com/morrowind/mods/43576"
LICENSE: "free-use"
KEYWORDS: "openmw"
SRC_URI: "Correct_Iron_Warhammer-43576-1-0.rar"
INSTALL_DIRS: ["Data Files"]
Note that custom classes would not be usable in fields, which would need to be able to be initialized as primitive types, lists, and dicts.
It might even be possible to include phase functions as strings, but some packages would probably still need to use the pure python version as defining custom functions would be difficult (maybe yaml tags to differentiate between functions and strings instead of just inferring the type via the name when overriding phase functions? However it will probably end up more complex compared to just using pure python for complicated packages).
Yaml might be preferred over toml in some circumstances, as it would make it easier to handle deeply-nested data such as may be necessary with the install structures. However I'm not sure if it's nested enough to be a problem, since we can use inline tables in toml to simplify the lowest level, which hopefully is short enough that a single line is sufficient.
E.g.
INSTALL_DIRS:
- PATH: Data Files
PLUGINS:
- NAME: Foo.esp
REQUIRED_USE: bar
INSTALL_DIRS: [
{
PATH: Data Files,
PLUGINS: [
{
NAME: Foo.esp,
REQUIRED_USE: bar,
}
],
}
]
Compared to in toml (gitlab can't even manage to highlight inline tables properly):
INSTALL_DIRS = [
# Inline is actually okay as long as there aren't many fields. However this must all be on one line!
{ PATH = "Data Files", PLUGINS = [ { NAME = "Foo.esp", REQUIRED_USE = "bar" } ] }
]
# Combination of tables and inline may be best
[[INSTALL_DIRS]]
PATH = "Data Files"
PLUGINS = [
{NAME="Foo.esp", REQUIRED_USE="bar"}
]
# Long-form
[[INSTALL_DIRS]]
PATH = "Data Files"
[[INSTALL_DIRS.PLUGINS]]
NAME="Foo.esp"
REQUIRED_USE="bar"