Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44eb158748 | |||
| d3917b10e7 | |||
| 86b3b74b21 | |||
| bb385f7786 | |||
| e07ad4c9ee | |||
| 1e03b45986 | |||
| 7a1b556b25 | |||
| d7911ffaf7 | |||
| daa7f54dd0 | |||
| 753136ade4 | |||
| 579763620d | |||
| cbc22adb76 | |||
| 82bb65bd52 | |||
| 671e553239 | |||
| fa4bcc034d | |||
| 0a048da8a4 | |||
| 7808a1166c | |||
| b9b2ebbe13 | |||
| b4b53e80eb | |||
| 2212fdabf7 | |||
| 1e8a174e0c | |||
| 6868d5ba6f | |||
| e203006537 | |||
| 1c72e1e564 |
+1
-1
@@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 1.1.2
|
||||
current_version = 1.1.5
|
||||
commit = True
|
||||
tag = True
|
||||
tag_name = {new_version}
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
QMK_HOME: ~/qmk_firmware
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt-get update && apt-get install -y python3-venv
|
||||
@@ -32,13 +32,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
@@ -53,13 +53,13 @@ jobs:
|
||||
QMK_HOME: $HOME/qmk_firmware
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: (MSYS2) Setup and install dependencies
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-pillow
|
||||
install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-pillow mingw-w64-x86_64-rust
|
||||
|
||||
- name: (MSYS2) Install Python dependencies
|
||||
shell: msys2 {0}
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
@@ -10,17 +10,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.7'
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -33,20 +33,20 @@ jobs:
|
||||
pip download -d "${GITHUB_WORKSPACE}/dist" qmk=="${{ steps.previoustag.outputs.tag }}"
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2.1.0
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and Push to Docker Hub
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v5.1.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
|
||||
@@ -18,17 +18,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.7'
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run ci_tests
|
||||
run: ./ci_tests
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install setuptools wheel
|
||||
pip install setuptools wheel
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
- name: Bump version
|
||||
@@ -54,27 +54,27 @@ jobs:
|
||||
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: qmk
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_APITOKEN }}
|
||||
run: |
|
||||
python3 -m build
|
||||
twine upload dist/*
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v2.1.0
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and Push to Docker Hub
|
||||
uses: docker/build-push-action@v4.0.0
|
||||
uses: docker/build-push-action@v5.1.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
|
||||
@@ -36,8 +36,8 @@ python3 -m pip install -r requirements-dev.txt
|
||||
# Ensure that qmk works
|
||||
echo "*** Testing 'qmk clone -h'"
|
||||
qmk clone -h
|
||||
echo "*** Testing 'qmk config -a'"
|
||||
qmk config -a
|
||||
#echo "*** Testing 'qmk config -a'" # Test disabled as `milc` at least 1.6.8+ returns False and thus non-zero exit code
|
||||
#qmk config -a
|
||||
echo "*** Testing 'qmk setup -n'"
|
||||
qmk setup -n
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"""A program to help you work with qmk_firmware."""
|
||||
|
||||
__version__ = '1.1.2'
|
||||
__version__ = '1.1.5'
|
||||
|
||||
@@ -10,6 +10,8 @@ import sys
|
||||
from platform import platform
|
||||
from traceback import print_exc
|
||||
|
||||
from . import switch_to_venv # noqa, intentionally unused
|
||||
|
||||
import milc
|
||||
|
||||
from . import __version__
|
||||
|
||||
@@ -6,3 +6,4 @@ from . import clone # noqa
|
||||
from . import console # noqa
|
||||
from . import env # noqa
|
||||
from . import setup # noqa
|
||||
from . import pip # noqa
|
||||
|
||||
@@ -52,7 +52,8 @@ KNOWN_BOOTLOADERS = {
|
||||
('239A', '000E'): 'caterina: Adafruit ItsyBitsy 32U4 5v',
|
||||
('2A03', '0036'): 'caterina: Arduino Leonardo',
|
||||
('2A03', '0037'): 'caterina: Arduino Micro',
|
||||
('314B', '0106'): 'apm32-dfu: APM32 DFU ISP Mode'
|
||||
('314B', '0106'): 'apm32-dfu: APM32 DFU ISP Mode',
|
||||
('342D', 'DFA0'): 'wb32-dfu: WB32 Device in DFU Mode'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
"""Installs python dependencies.
|
||||
"""
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
from milc import cli
|
||||
|
||||
from qmk_cli.helpers import find_qmk_firmware, is_qmk_firmware
|
||||
|
||||
|
||||
def _run_pip(pip_args, dry_run=False, upgrade=False):
|
||||
pip_exe = ['pip']
|
||||
if cli.config.user.pip_exe:
|
||||
pip_exe = shlex.split(cli.config.user.pip_exe)
|
||||
pip_command = [*pip_exe, *pip_args]
|
||||
pip_command[0] = shutil.which(pip_command[0])
|
||||
if shutil.which(pip_command[0]) is None:
|
||||
pip_command[0] = 'pip' # Hope falling back to unqualified path works
|
||||
|
||||
if dry_run:
|
||||
print(" ".join(shlex.quote(str(s)) for s in pip_command))
|
||||
return True
|
||||
|
||||
try:
|
||||
with subprocess.Popen(pip_command, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, bufsize=1, universal_newlines=True, encoding='utf-8') as p:
|
||||
for line in p.stdout:
|
||||
print(line, end='')
|
||||
except Exception as e:
|
||||
pip_cmd = ' '.join([s.replace(' ', r'\ ') for s in pip_command])
|
||||
cli.log.error("Could not run '%s': %s: %s", pip_cmd, e.__class__.__name__, e)
|
||||
return False
|
||||
|
||||
if p.returncode == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def install_qmk_python_deps(upgrade=False, developer=False, dry_run=False):
|
||||
qmk_firmware_dir = find_qmk_firmware()
|
||||
if not is_qmk_firmware(qmk_firmware_dir):
|
||||
cli.log.error('Could not find {fg_cyan}qmk_firmware{fg_reset}!')
|
||||
return False
|
||||
|
||||
reqs_path = qmk_firmware_dir / 'requirements.txt' if not developer else qmk_firmware_dir / 'requirements-dev.txt'
|
||||
|
||||
pip_args = ['install', '-r', reqs_path]
|
||||
if upgrade:
|
||||
pip_args.append('--upgrade')
|
||||
|
||||
if _run_pip(pip_args, dry_run=dry_run):
|
||||
if not dry_run:
|
||||
cli.log.info('Successfully installed python dependencies!')
|
||||
return True
|
||||
else:
|
||||
if not dry_run:
|
||||
cli.log.error('Failed to install python dependencies!')
|
||||
return False
|
||||
|
||||
|
||||
@cli.argument('-u', '--upgrade', arg_only=True, action='store_true', help='Upgrades existing packages.')
|
||||
@cli.argument('-d', '--developer', arg_only=True, action='store_true', help='Installs QMK Firmware developer dependencies, too.')
|
||||
@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help='Prints the commands to execute, rather than executing them.')
|
||||
@cli.subcommand('Installs python dependencies.')
|
||||
def install_deps(cli):
|
||||
return install_qmk_python_deps(upgrade=cli.args.upgrade, developer=cli.args.developer, dry_run=cli.args.dry_run)
|
||||
|
||||
|
||||
@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help='Prints the commands to execute, rather than executing them.')
|
||||
@cli.argument('arguments', arg_only=True, default=[], nargs='*', help='The arguments to pass to pip.')
|
||||
@cli.subcommand('Runs pip inside the qmk venv.')
|
||||
def pip(cli):
|
||||
return _run_pip(cli.args.arguments, dry_run=cli.args.dry_run)
|
||||
@@ -0,0 +1,37 @@
|
||||
""" Activates a virtualenv if not already present
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
if not os.environ.get('VIRTUAL_ENV') or True:
|
||||
import site
|
||||
from pathlib import Path
|
||||
|
||||
# Build a venv if required
|
||||
INTENDED_VENV_PATH = Path(os.environ['HOME']) / ".local/qmk_venv"
|
||||
if not INTENDED_VENV_PATH.exists():
|
||||
from venv import EnvBuilder
|
||||
builder = EnvBuilder(with_pip=True)
|
||||
builder.create(str(INTENDED_VENV_PATH))
|
||||
|
||||
# Determine the venv's bin directory
|
||||
bin_dir = INTENDED_VENV_PATH / "bin"
|
||||
|
||||
# Update the environment to point to the QMK venv (effectively matches `source path_to_venv/bin/activate`)
|
||||
os.environ["PATH"] = os.pathsep.join([str(bin_dir), *os.environ.get("PATH", "").split(os.pathsep)])
|
||||
os.environ["VIRTUAL_ENV"] = str(INTENDED_VENV_PATH)
|
||||
if 'PYTHONHOME' in os.environ:
|
||||
os.environ.pop('PYTHONHOME')
|
||||
|
||||
# Prepend the venv's library paths to the python import mechanism
|
||||
pyver = sys.version_info[:2]
|
||||
lib_dir = INTENDED_VENV_PATH / f'lib/python{pyver[0]}.{pyver[1]}/site-packages'
|
||||
for d in [lib_dir, bin_dir]:
|
||||
site.addsitedir(str(d))
|
||||
sys.path.insert(0, str(d))
|
||||
|
||||
# Update the python prefixes
|
||||
sys.base_prefix = sys.prefix
|
||||
sys.prefix = str(INTENDED_VENV_PATH)
|
||||
@@ -9,19 +9,19 @@ ignore = E501,E226
|
||||
|
||||
[metadata]
|
||||
name = qmk
|
||||
version = 1.1.2
|
||||
version = 1.1.5
|
||||
author = skullydazed
|
||||
author_email = skullydazed@gmail.com
|
||||
description = A program to help users work with QMK Firmware.
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
license = MIT License
|
||||
project_urls =
|
||||
project_urls =
|
||||
Bug Tracker = https://github.com/qmk/qmk_cli/issues
|
||||
Documentation = https://docs.qmk.fm/#/cli
|
||||
Homepage = https://qmk.fm/
|
||||
Source = https://github.com/qmk/qmk_cli/
|
||||
classifiers =
|
||||
classifiers =
|
||||
Development Status :: 3 - Alpha
|
||||
Environment :: Console
|
||||
Intended Audience :: Developers
|
||||
@@ -35,9 +35,9 @@ classifiers =
|
||||
Topic :: Utilities
|
||||
|
||||
[options]
|
||||
install_requires =
|
||||
install_requires =
|
||||
hid
|
||||
milc>=1.4.2
|
||||
milc>=1.6.8
|
||||
pyusb
|
||||
setuptools>=45
|
||||
# qmk_firmware packages
|
||||
@@ -51,7 +51,7 @@ packages = find:
|
||||
python_requires = >=3.7
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
console_scripts =
|
||||
qmk = qmk_cli.script_qmk:main
|
||||
|
||||
[yapf]
|
||||
@@ -72,13 +72,13 @@ continuation_indent_width = 4
|
||||
dedent_closing_brackets = True
|
||||
disable_ending_comma_heuristic = False
|
||||
each_dict_entry_on_separate_line = True
|
||||
i18n_comment =
|
||||
i18n_function_call =
|
||||
i18n_comment =
|
||||
i18n_function_call =
|
||||
indent_blank_lines = False
|
||||
indent_dictionary_value = True
|
||||
indent_width = 4
|
||||
join_multiple_lines = False
|
||||
no_spaces_around_selected_binary_operators =
|
||||
no_spaces_around_selected_binary_operators =
|
||||
spaces_around_default_or_named_assign = False
|
||||
spaces_around_power_operator = False
|
||||
spaces_before_comment = 2
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ gh_pat = environ.get('QMK_BOT_TOKEN', '')
|
||||
gh_repo_owner = environ.get('REPO_OWNER', 'qmk')
|
||||
gh_repo_name = environ.get('REPO_NAME', 'qmk_fpm')
|
||||
gh_ref = environ.get('BRANCH_NAME', 'main')
|
||||
gh_workflow_ids = environ.get('WORKFLOW_IDS', 'debian-buster-publish.yml,fedora-32-publish.yml,ubuntu-focal-publish.yml').split(',')
|
||||
gh_workflow_ids = environ.get('WORKFLOW_IDS', 'all-trigger.yml').split(',')
|
||||
gh_api_url = environ.get('GITHUB_API_URL', 'https://api.github.com')
|
||||
gh_workflow_args = {'ref': gh_ref}
|
||||
gh_workflow_headers = {'Accept': 'application/vnd.github.v3+json'}
|
||||
|
||||
Reference in New Issue
Block a user