Skip to content

Commit

Permalink
[docs] Move gh repo docs and flatten docs resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Qonfused committed Jul 28, 2023
1 parent 4d6ac5e commit da63984
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 17 deletions.
File renamed without changes.
13 changes: 13 additions & 0 deletions docs/README.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ While this project is primarily intended to be used for PC Hackintosh projects u
- [ ] Compiler options with external refs and patchfiles
- [ ] CI support for managing and building Kexts with XCode

## Installation

See the [install](/docs/install.md) documentation for more information on how to
install OCE Build as an executable or as a Python library.

## Getting Started

>TODO
## Contributing

See the [contributing](/docs/contributing.md) documentation for more information on how to contribute to this project.

## Development

Development of this project is done using [Poetry](https://python-poetry.org/). Poetry is a Python package manager that provides a virtual environment for managing dependencies and project configuration. Poetry is required to be installed on your system to develop and build this project.
Expand Down
15 changes: 10 additions & 5 deletions ci/docsgen/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
##
"""Documentation writers and parsers for OpenCore configuration file schemas."""

from collections import OrderedDict
from datetime import datetime, timezone

from typing import Optional

from ci import PROJECT_DOCS

from ocebuild.parsers.dict import flatten_dict, nested_get
from ocebuild.parsers.dict import flatten_dict, nested_get, merge_dict
from ocebuild.parsers.plist import write_plist
from ocebuild.parsers.regex import re_search
from ocebuild.parsers.schema import format_markdown_entry
Expand Down Expand Up @@ -126,12 +127,16 @@ def parse_fmarkdown_schema(raw_schema: dict,
schema, sample = get_configuration_schema(commit=commit_sha,
raw_schema=(raw_schema := {}),
get_sample=True)
schema_meta = OrderedDict(**{
'#Revision': {
'OpenCore-Version': entry.get('version', 'Unknown'),
}
})

schema_dir = PROJECT_DOCS.joinpath('schema')
with open(schema_dir.joinpath('Schema.plist'), 'w') as file:
schema_plist = write_plist(schema)
with open(PROJECT_DOCS.joinpath('Resources', 'Schema.plist'), 'w') as file:
schema_plist = write_plist(merge_dict(schema_meta, schema))
file.write(schema_plist)
with open(schema_dir.joinpath('Schema.md'), 'w') as file:
with open(PROJECT_DOCS.joinpath('schema.md'), 'w') as file:
schema_doc = parse_fmarkdown_schema(raw_schema, schema, sample,
title="OpenCore Config.plist Schema",
metadata=entry)
Expand Down
5 changes: 5 additions & 0 deletions docs/schema/Schema.plist → docs/resources/Schema.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#Revision</key>
<dict>
<key>OpenCore-Version</key>
<string>0.9.3</string>
</dict>
<key>ACPI</key>
<dict>
<key>Add</key>
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion docs/schema/Schema.md → docs/schema.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 id=schema>OpenCore Config.plist Schema - v0.9.3</h1>

#### Last Updated: `2023-07-27 20:16:06.518836+00:00`
#### Last Updated: `2023-07-28 06:50:54.566136+00:00`

#### Revision: `{ SHA1: d52fc46ba650ce1afe00c354331a0657a533ef18 }`

Expand Down Expand Up @@ -1216,7 +1216,9 @@ For development purposes one may take risks and try other values. Consider a GPU
* `BAR1` supports sizes from 2 MB to 256 MB. Its value is 256 MB.

*Example 1*: Setting `ResizeAppleGpuBars` to 1 GB will change `BAR0` to 1 GB and leave `BAR1` unchanged.

*Example 2*: Setting `ResizeAppleGpuBars` to 1 MB will change `BAR0` to 256 MB and `BAR0` to 2 MB.

*Example 3*: Setting `ResizeAppleGpuBars` to 16 GB will make no changes.

*Note*: See `ResizeGpuBars` quirk for general GPU PCI BAR size configuration and more details about the technology.
Expand Down Expand Up @@ -5691,7 +5693,9 @@ Consider a GPU with 2 BARs:
* `BAR1` supports sizes from 2 MB to 256 MB. Its value is 256 MB.

*Example 1*: Setting `ResizeGpuBars` to 1 GB will change `BAR0` to 1 GB and leave `BAR1` unchanged.

*Example 2*: Setting `ResizeGpuBars` to 1 MB will change `BAR0` to 256 MB and `BAR0` to 2 MB.

*Example 3*: Setting `ResizeGpuBars` to 16 GB will change `BAR0` to 8 GB and leave `BAR1` unchanged.

*Note 1*: This quirk shall not be used to workaround macOS limitation to address BARs over 1 GB. `ResizeAppleGpuBars` should be used instead.
Expand Down
4 changes: 2 additions & 2 deletions ocebuild/parsers/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def parse_schema(file: Union[List[str], TextIOWrapper],

return schema

def format_markdown_entry(key: str, entry: Optional[str]=None) -> str:
def format_markdown_entry(key: str, entry: str) -> str:
"""Formats a Sample.plist schema entry as markdown."""

# Converts the key to a markdown header
Expand Down Expand Up @@ -436,7 +436,7 @@ def format_markdown_entry(key: str, entry: Optional[str]=None) -> str:
(r'(:|`)\\ `', r'\1\n * `'), # Kernel -> Emulate -> Cpuid1Data
(r'\n\s*?\*?\s*?\`(OCAU|HDA)\:', r'\n* `\1:'), # UEFI -> Audio -> AudioCodec/AudioOutMask
(r'\\\*\*', r' **'),
(r' \\ \*', r'\n*'),
(r' \\ \*', r'\n\n*'),
(r'\\\`}\).', r'}`).'), # PlatformInfo -> UseRawUuidEncoding
# Handle escaped backslashes
(r'\\\s?\n', r'\n'),
Expand Down
10 changes: 2 additions & 8 deletions ocebuild_cli/commands/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from ocebuild.filesystem import glob
from ocebuild.parsers.dict import nested_get
from ocebuild.parsers.plist import write_plist
from ocebuild.parsers.regex import re_search
from ocebuild.pipeline.config import *
from ocebuild.pipeline.lock import read_lockfile
Expand Down Expand Up @@ -63,13 +62,8 @@ def cli(env, cwd, out):
LOCKFILE = glob(cwd, '**/build.lock', first=True)
lockfile = read_lockfile(LOCKFILE) if LOCKFILE.exists() else None

# Extract the Sample.plist schema
schema = read_schema(lockfile)

# # Uncomment to dump the schema output to a file
# from pprint import pprint; pprint(schema, stream=open('Schema.txt', 'w'))
# with open('Schema.plist', 'w') as file:
# file.write(write_plist(schema))
# # Extract the Sample.plist schema
# schema = read_schema(lockfile, raw_schema=(raw_schema := {}))


__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "ocebuild"
version = "0.0.0-dev"
description = "Portable OpenCore EFI dependency & build manager."
authors = [ "Cory Bennett <[email protected]>" ]
readme = "docs/README.md"
readme = "README.md"
license = "BSD-3-Clause"
homepage = "https://github.com/Qonfused/OCE-Build"
repository = "https://github.com/Qonfused/OCE-Build"
Expand Down

0 comments on commit da63984

Please sign in to comment.