Make the docs and man pages available in the macos bundle as well

This commit is contained in:
Kovid Goyal 2022-08-19 12:38:10 +05:30
parent 1f499a7c6c
commit 3288400005
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 31 additions and 2 deletions

View File

@ -35,6 +35,12 @@ profile:
app:
python3 setup.py kitty.app $(VVAL)
linux-package: FORCE
rm -rf linux-package
python3 setup.py linux-package
FORCE:
man:
$(MAKE) -C docs man

View File

@ -52,7 +52,7 @@ def ref_map() -> Dict[str, Dict[str, str]]:
return ans
def resolve_ref(ref: str) -> str:
def resolve_ref(ref: str, website_url: Callable[[str], str] = website_url) -> str:
m = ref_map()
href = m['ref'].get(ref, '')
if href:

View File

@ -249,3 +249,22 @@ def clear_handled_signals(*a: Any) -> None:
signal.pthread_sigmask(signal.SIG_UNBLOCK, handled_signals)
for s in handled_signals:
signal.signal(s, signal.SIG_DFL)
@run_once
def local_docs() -> str:
d = os.path.dirname
base = d(d(kitty_exe()))
subdir = os.path.join('doc', 'kitty', 'html')
linux_ans = os.path.join(base, 'share', subdir)
if getattr(sys, 'frozen', False):
if is_macos:
return os.path.join(d(d(d(extensions_dir))), subdir)
return linux_ans
if os.path.isdir(linux_ans):
return linux_ans
for candidate in ('/usr', '/usr/local', '/opt/homebrew'):
q = os.path.join(candidate, 'share', subdir)
if os.path.isdir(q):
return q
return ''

View File

@ -51,13 +51,15 @@ class TestBuild(BaseTest):
def test_filesystem_locations(self) -> None:
from kitty.constants import (
logo_png_file, shell_integration_dir, terminfo_dir
local_docs, logo_png_file, shell_integration_dir, terminfo_dir
)
zsh = os.path.join(shell_integration_dir, 'zsh')
self.assertTrue(os.path.isdir(terminfo_dir), f'Terminfo dir: {terminfo_dir}')
self.assertTrue(os.path.exists(logo_png_file), f'Logo file: {logo_png_file}')
self.assertTrue(os.path.exists(zsh), f'Shell integration: {zsh}')
self.assertTrue(os.access(os.path.join(shell_integration_dir, 'ssh', 'askpass.py'), os.X_OK))
if getattr(sys, 'frozen', False):
self.assertTrue(os.path.isdir(local_docs()), f'Local docs: {local_docs()}')
def test_ca_certificates(self):
import ssl

View File

@ -1280,6 +1280,8 @@ def create_macos_bundle_gunk(dest: str) -> None:
os.mkdir(ddir / 'Contents')
with open(ddir / 'Contents/Info.plist', 'wb') as fp:
fp.write(macos_info_plist())
copy_man_pages(str(ddir))
copy_html_docs(str(ddir))
os.rename(ddir / 'share', ddir / 'Contents/Resources')
os.rename(ddir / 'bin', ddir / 'Contents/MacOS')
os.rename(ddir / 'lib', ddir / 'Contents/Frameworks')