-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌠Packaging revamp, introduce cleaner installation, add cross-compila…
…tion (#12) Closes #7 and sets up baseline work for #2, which can be continued with setting up `cibuildwheel`.
- Loading branch information
Showing
8 changed files
with
314 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
""" | ||
Copyright (c) 2023 Agriya Khetarpal. All rights reserved. | ||
python-hugo: Binaries for the Hugo static site generator, installable with pip | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import importlib.metadata | ||
import os | ||
import platform | ||
import sys | ||
from functools import lru_cache | ||
|
||
HUGO_VERSION = importlib.metadata.version("python-hugo") | ||
FILE_EXT = ".exe" if sys.platform == "win32" else "" | ||
HUGO_PLATFORM = { | ||
"darwin": "darwin", | ||
"linux": "linux", | ||
"win32": "windows", | ||
}[sys.platform] | ||
HUGO_ARCH = { | ||
"x86_64": "amd64", | ||
"arm64": "arm64", | ||
"AMD64": "amd64", | ||
"aarch64": "arm64", | ||
}[platform.machine()] | ||
|
||
|
||
@lru_cache(maxsize=1) | ||
def hugo_executable(): | ||
""" | ||
Returns the path to the Hugo executable. | ||
""" | ||
return os.path.join( | ||
os.path.dirname(__file__), | ||
"binaries", | ||
f"hugo-{HUGO_VERSION}-{HUGO_PLATFORM}-{HUGO_ARCH}" + FILE_EXT, | ||
) | ||
|
||
|
||
def __call(): | ||
""" | ||
Hugo binary entry point. Passes all command-line arguments to Hugo. | ||
""" | ||
os.execvp(hugo_executable(), ["hugo", *sys.argv[1:]]) |
Oops, something went wrong.