Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from jonasblixt/python-cli2
Punchboot-tool merge
- Loading branch information
Showing
330 changed files
with
16,237 additions
and
13,500 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Based on the Linux kernel .clang-format | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# clang-format configuration file. Intended for clang-format >= 11. | ||
# | ||
# For more information, see: | ||
# | ||
# Documentation/process/clang-format.rst | ||
# https://clang.llvm.org/docs/ClangFormat.html | ||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
# | ||
--- | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignConsecutiveMacros: AcrossEmptyLinesAndComments | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: false | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeComma | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 100 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: true | ||
SeparateDefinitionBlocks: Always | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: false | ||
|
||
ForEachMacros: | ||
- 'bpak_foreach_part' | ||
- 'bpak_foreach_meta' | ||
- 'foreach_fuse' | ||
|
||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '.*' | ||
Priority: 1 | ||
IncludeIsMainRegex: '(Test)?$' | ||
IndentCaseLabels: false | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 4 | ||
ObjCSpaceAfterProperty: true | ||
ObjCSpaceBeforeProtocolList: true | ||
|
||
# Taken from git's rules | ||
PenaltyBreakAssignment: 10 | ||
PenaltyBreakBeforeFirstCallParameter: 30 | ||
PenaltyBreakComment: 10 | ||
PenaltyBreakFirstLessLess: 0 | ||
PenaltyBreakString: 10 | ||
PenaltyExcessCharacter: 100 | ||
PenaltyReturnTypeOnItsOwnLine: 100 | ||
|
||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: CaseInsensitive | ||
SortUsingDeclarations: false | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatementsExceptForEachMacros | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp03 | ||
TabWidth: 4 | ||
UseTab: Never | ||
... |
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,113 @@ | ||
name: Build punchboot-tools | ||
# push | ||
on: [pull_request] | ||
|
||
# REMEMBER: If the libusb versions for macos are updated the 'macos deps', | ||
# setup.py and pyproject.toml must also be updated since they have hard coded | ||
# version information in path's. | ||
env: | ||
PYTHON_VERSION: "3.12" | ||
LIBUSB_MACOS_ARM64_URL: "https://ghcr.io/v2/homebrew/core/libusb/blobs/sha256:ab90516396d8dc99f96d31615bcbddfcfd2082fcc7494dabb9d22b275628e800" | ||
LIBUSB_MACOS_X86_64_URL: "https://ghcr.io/v2/homebrew/core/libusb/blobs/sha256:e79be7d4c611f0017567172771761b1df62d140e79ffa6d2538577eb24a48e44" | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
|
||
- if: startsWith(matrix.os, 'windows') == true | ||
name: Windows deps | ||
shell: cmd | ||
run: | | ||
vcpkg install | ||
- if: startsWith(matrix.os, 'macos') == true | ||
name: macos deps | ||
run: | | ||
# Here we download specfic version of libusb for both x86_64 and arm64. | ||
# It's not possible to have multiple installations with different architectures installed | ||
# through homebrew, so we do it like this instead to support cross compiling arm64 | ||
# wheels on an x86_64 host. | ||
curl -L -H "Authorization: Bearer QQ==" -o libusb_arm64.tar.gz ${LIBUSB_MACOS_ARM64_URL} | ||
curl -L -H "Authorization: Bearer QQ==" -o libusb_x86_64.tar.gz ${LIBUSB_MACOS_X86_64_URL} | ||
mkdir libusb_x86_64 && tar xf libusb_x86_64.tar.gz -C libusb_x86_64 --strip-components 1 | ||
mkdir libusb_arm64 && tar xf libusb_arm64.tar.gz -C libusb_arm64 --strip-components 1 | ||
# The libusb binaries from homebrew comes with an id that starts with "@@HOMEBREW..." | ||
# This confuses the 'delocate-wheel' tool used by 'cibuildwheel' to bundle dependencies | ||
# in binary wheels. | ||
# | ||
# If we prefix it with "@rpath" it works better. | ||
install_name_tool -id @rpath/libusb-1.0.0.dylib libusb_x86_64/1.0.26/lib/libusb-1.0.0.dylib | ||
install_name_tool -id @rpath/libusb-1.0.0.dylib libusb_arm64/1.0.26/lib/libusb-1.0.0.dylib | ||
- name: Build wheels | ||
uses: pypa/cibuildwheel@v2.16.2 | ||
with: | ||
package-dir: . | ||
output-dir: wheelhouse | ||
config-file: "pyproject.toml" | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi_test: | ||
name: Upload to PyPi (Test) | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.repository == 'jonasblixt/punchboot' && github.event_name == 'workflow_dispatch' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
upload_pypi: | ||
name: Upload to PyPi | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.repository == 'jonasblixt/punchboot' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
skip_existing: true |
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 |
---|---|---|
|
@@ -38,3 +38,5 @@ doc/html/ | |
doc/latex/ | ||
tags | ||
download | ||
*.egg-info | ||
*.so |
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,23 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.7.1 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: | ||
- "semver>=3,<4" | ||
- "click>=8,<9" | ||
pass_filenames: false # This and the args, argument are needed to make mypy read pyproject.toml | ||
args: ["."] | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.6 | ||
hooks: | ||
- id: ruff | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v17.0.5 | ||
hooks: | ||
- id: clang-format |
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
Oops, something went wrong.