Skip to content

Commit 3288400

Browse files
committed
Make the docs and man pages available in the macos bundle as well
1 parent 1f499a7 commit 3288400

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ profile:
3535
app:
3636
python3 setup.py kitty.app $(VVAL)
3737

38+
linux-package: FORCE
39+
rm -rf linux-package
40+
python3 setup.py linux-package
41+
42+
FORCE:
43+
3844
man:
3945
$(MAKE) -C docs man
4046

kitty/conf/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def ref_map() -> Dict[str, Dict[str, str]]:
5252
return ans
5353

5454

55-
def resolve_ref(ref: str) -> str:
55+
def resolve_ref(ref: str, website_url: Callable[[str], str] = website_url) -> str:
5656
m = ref_map()
5757
href = m['ref'].get(ref, '')
5858
if href:

kitty/constants.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,22 @@ def clear_handled_signals(*a: Any) -> None:
249249
signal.pthread_sigmask(signal.SIG_UNBLOCK, handled_signals)
250250
for s in handled_signals:
251251
signal.signal(s, signal.SIG_DFL)
252+
253+
254+
@run_once
255+
def local_docs() -> str:
256+
d = os.path.dirname
257+
base = d(d(kitty_exe()))
258+
subdir = os.path.join('doc', 'kitty', 'html')
259+
linux_ans = os.path.join(base, 'share', subdir)
260+
if getattr(sys, 'frozen', False):
261+
if is_macos:
262+
return os.path.join(d(d(d(extensions_dir))), subdir)
263+
return linux_ans
264+
if os.path.isdir(linux_ans):
265+
return linux_ans
266+
for candidate in ('/usr', '/usr/local', '/opt/homebrew'):
267+
q = os.path.join(candidate, 'share', subdir)
268+
if os.path.isdir(q):
269+
return q
270+
return ''

kitty_tests/check_build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ def test_all_kitten_names(self) -> None:
5151

5252
def test_filesystem_locations(self) -> None:
5353
from kitty.constants import (
54-
logo_png_file, shell_integration_dir, terminfo_dir
54+
local_docs, logo_png_file, shell_integration_dir, terminfo_dir
5555
)
5656
zsh = os.path.join(shell_integration_dir, 'zsh')
5757
self.assertTrue(os.path.isdir(terminfo_dir), f'Terminfo dir: {terminfo_dir}')
5858
self.assertTrue(os.path.exists(logo_png_file), f'Logo file: {logo_png_file}')
5959
self.assertTrue(os.path.exists(zsh), f'Shell integration: {zsh}')
6060
self.assertTrue(os.access(os.path.join(shell_integration_dir, 'ssh', 'askpass.py'), os.X_OK))
61+
if getattr(sys, 'frozen', False):
62+
self.assertTrue(os.path.isdir(local_docs()), f'Local docs: {local_docs()}')
6163

6264
def test_ca_certificates(self):
6365
import ssl

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,8 @@ def create_macos_bundle_gunk(dest: str) -> None:
12801280
os.mkdir(ddir / 'Contents')
12811281
with open(ddir / 'Contents/Info.plist', 'wb') as fp:
12821282
fp.write(macos_info_plist())
1283+
copy_man_pages(str(ddir))
1284+
copy_html_docs(str(ddir))
12831285
os.rename(ddir / 'share', ddir / 'Contents/Resources')
12841286
os.rename(ddir / 'bin', ddir / 'Contents/MacOS')
12851287
os.rename(ddir / 'lib', ddir / 'Contents/Frameworks')

0 commit comments

Comments
 (0)