Compare commits
1 Commits
1.1.7
..
userspace2
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d6a53d792 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 1.1.7
|
current_version = 1.1.6
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
tag_name = {new_version}
|
tag_name = {new_version}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ jobs:
|
|||||||
- name: (MSYS2) Install Python dependencies
|
- name: (MSYS2) Install Python dependencies
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --break-system-packages --force-reinstall --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
|
|
||||||
- name: (MSYS2) Install QMK CLI from source
|
- name: (MSYS2) Install QMK CLI from source
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
- name: Build and Push to Docker Hub
|
- name: Build and Push to Docker Hub
|
||||||
uses: docker/build-push-action@v6.15.0
|
uses: docker/build-push-action@v6.9.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
- name: Build and Push to Docker Hub
|
- name: Build and Push to Docker Hub
|
||||||
uses: docker/build-push-action@v6.15.0
|
uses: docker/build-push-action@v6.9.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
"""A program to help you work with qmk_firmware."""
|
"""A program to help you work with qmk_firmware."""
|
||||||
|
|
||||||
__version__ = '1.1.7'
|
__version__ = '1.1.6'
|
||||||
|
|||||||
+7
-4
@@ -2,6 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from platformdirs import user_data_dir
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ def is_qmk_firmware(qmk_firmware):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=2)
|
||||||
def find_qmk_firmware():
|
def find_qmk_firmware():
|
||||||
"""Look for qmk_firmware in the usual places.
|
"""Look for qmk_firmware in the usual places.
|
||||||
|
|
||||||
@@ -44,10 +45,13 @@ def find_qmk_firmware():
|
|||||||
return path.resolve()
|
return path.resolve()
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
hidden_home = Path(user_data_dir('qmk_cli', 'QMK')) / 'qmk_firmware'
|
||||||
|
if hidden_home.exists():
|
||||||
|
return hidden_home
|
||||||
|
|
||||||
return Path.home() / 'qmk_firmware'
|
return Path.home() / 'qmk_firmware'
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
|
||||||
def in_qmk_firmware():
|
def in_qmk_firmware():
|
||||||
"""Returns the path to the qmk_firmware we are currently in, or None if we are not inside qmk_firmware.
|
"""Returns the path to the qmk_firmware we are currently in, or None if we are not inside qmk_firmware.
|
||||||
"""
|
"""
|
||||||
@@ -74,7 +78,7 @@ def is_qmk_userspace(qmk_userspace):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=2)
|
||||||
def find_qmk_userspace():
|
def find_qmk_userspace():
|
||||||
"""Look for qmk_userspace in the usual places.
|
"""Look for qmk_userspace in the usual places.
|
||||||
"""
|
"""
|
||||||
@@ -93,7 +97,6 @@ def find_qmk_userspace():
|
|||||||
return Path.home() / 'qmk_userspace'
|
return Path.home() / 'qmk_userspace'
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
|
||||||
def in_qmk_userspace():
|
def in_qmk_userspace():
|
||||||
"""Returns the path to the qmk_userspace we are currently in, or None if we are not inside qmk_userspace.
|
"""Returns the path to the qmk_userspace we are currently in, or None if we are not inside qmk_userspace.
|
||||||
"""
|
"""
|
||||||
|
|||||||
+2
-14
@@ -13,7 +13,7 @@ from traceback import print_exc
|
|||||||
import milc
|
import milc
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .helpers import find_qmk_firmware, is_qmk_firmware, find_qmk_userspace
|
from .helpers import find_qmk_firmware, is_qmk_firmware, find_qmk_userspace, is_qmk_userspace
|
||||||
|
|
||||||
milc.cli.milc_options(version=__version__)
|
milc.cli.milc_options(version=__version__)
|
||||||
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
|
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
|
||||||
@@ -52,19 +52,7 @@ def main():
|
|||||||
if 'windows' in platform().lower():
|
if 'windows' in platform().lower():
|
||||||
msystem = os.environ.get('MSYSTEM', '')
|
msystem = os.environ.get('MSYSTEM', '')
|
||||||
|
|
||||||
# Assume the environment isn't workable by default
|
if 'mingw64' not in sys.executable or 'MINGW64' not in msystem:
|
||||||
env_ok = False
|
|
||||||
|
|
||||||
# Check if we're using the mingw64/msys2 environment
|
|
||||||
if 'mingw64' in sys.executable and 'MINGW64' in msystem:
|
|
||||||
env_ok = True
|
|
||||||
|
|
||||||
# Check if we're using a `uv`-based environment
|
|
||||||
if '\\uv\\' in sys.executable or '/uv/' in sys.executable:
|
|
||||||
env_ok = True
|
|
||||||
|
|
||||||
# If none of the options above were true, then we're in an unsupported environment. Bomb out.
|
|
||||||
if not env_ok:
|
|
||||||
print('ERROR: It seems you are not using the MINGW64 terminal.')
|
print('ERROR: It seems you are not using the MINGW64 terminal.')
|
||||||
print('Please close this terminal and open a new MSYS2 MinGW 64-bit terminal.')
|
print('Please close this terminal and open a new MSYS2 MinGW 64-bit terminal.')
|
||||||
print('Python: %s, MSYSTEM: %s' % (sys.executable, msystem))
|
print('Python: %s, MSYSTEM: %s' % (sys.executable, msystem))
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ from . import clone # noqa
|
|||||||
from . import console # noqa
|
from . import console # noqa
|
||||||
from . import env # noqa
|
from . import env # noqa
|
||||||
from . import setup # noqa
|
from . import setup # noqa
|
||||||
|
from . import userspace # noqa
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
"""Setup qmk_userspace on your computer.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from platformdirs import user_data_dir
|
||||||
|
|
||||||
|
from milc import cli
|
||||||
|
|
||||||
|
from milc.questions import yesno
|
||||||
|
from qmk_cli.git import git_clone
|
||||||
|
from qmk_cli.helpers import find_qmk_firmware, is_qmk_firmware, is_qmk_userspace
|
||||||
|
|
||||||
|
default_base = 'https://github.com'
|
||||||
|
default_fork = 'qmk/qmk_userspace'
|
||||||
|
default_branch = 'main'
|
||||||
|
|
||||||
|
|
||||||
|
@cli.argument('-n', '--no', arg_only=True, action='store_true', help='Answer no to all questions')
|
||||||
|
@cli.argument('-y', '--yes', arg_only=True, action='store_true', help='Answer yes to all questions')
|
||||||
|
@cli.argument('--baseurl', arg_only=True, default=default_base, help='The URL all git operations start from. Default: %s' % default_base)
|
||||||
|
@cli.argument('-b', '--branch', arg_only=True, default=default_branch, help='The branch to clone. Default: %s' % default_branch)
|
||||||
|
@cli.argument('-H', '--home', arg_only=True, default=Path(os.environ['QMK_USERSPACE']), type=Path, help='The location for qmk_userspace. Default: %s' % os.environ['QMK_HOME'])
|
||||||
|
@cli.argument('fork', arg_only=True, default=default_fork, nargs='?', help='The qmk_userspace fork to clone. Default: %s' % default_fork)
|
||||||
|
@cli.subcommand('Setup your computer for qmk_userspace.')
|
||||||
|
def userspace_setup(cli):
|
||||||
|
"""Guide the user through setting up their QMK environment.
|
||||||
|
"""
|
||||||
|
# Sanity checks
|
||||||
|
if cli.args.yes and cli.args.no:
|
||||||
|
cli.log.error("Can't use both --yes and --no at the same time.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if is_qmk_userspace(cli.args.home):
|
||||||
|
cli.log.info(f'Found qmk_userspace at {cli.args.home}.')
|
||||||
|
else:
|
||||||
|
cli.log.error('Could not find qmk_userspace!')
|
||||||
|
if yesno('Would you like to clone qmk_userspace?'):
|
||||||
|
git_url = f'{cli.args.baseurl}/{cli.args.fork}'
|
||||||
|
if not git_clone(git_url, cli.args.home, cli.args.branch):
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
cli.log.warning('Not cloning qmk_userspace due to user input or --no flag.')
|
||||||
|
|
||||||
|
qmk_firmware = find_qmk_firmware()
|
||||||
|
if is_qmk_firmware(qmk_firmware):
|
||||||
|
cli.log.info(f'Found qmk_firmware at {qmk_firmware}.')
|
||||||
|
else:
|
||||||
|
cli.log.error('Could not find qmk_firmware!')
|
||||||
|
if yesno('Would you like to clone qmk_firmware?'):
|
||||||
|
git_url = f'{cli.args.baseurl}/qmk/qmk_firmware'
|
||||||
|
hidden_home = Path(user_data_dir('qmk_cli', 'QMK')) / 'qmk_firmware'
|
||||||
|
if not git_clone(git_url, hidden_home, 'master'):
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
cli.log.warning('Not cloning qmk_firmware due to user input or --no flag.')
|
||||||
|
|
||||||
|
# Run `qmk doctor` to check the rest of the environment out
|
||||||
|
if cli.args.home.exists():
|
||||||
|
color = '--color' if cli.config.general.color else '--no-color'
|
||||||
|
unicode = '--unicode' if cli.config.general.unicode else '--no-unicode'
|
||||||
|
doctor_command = [Path(sys.argv[0]).as_posix(), color, unicode, 'doctor']
|
||||||
|
|
||||||
|
if cli.args.no:
|
||||||
|
doctor_command.append('-n')
|
||||||
|
|
||||||
|
if cli.args.yes:
|
||||||
|
doctor_command.append('-y')
|
||||||
|
|
||||||
|
cli.run(doctor_command, stdin=None, capture_output=False, cwd=cli.args.home)
|
||||||
@@ -9,7 +9,7 @@ ignore = E501,E226
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
name = qmk
|
name = qmk
|
||||||
version = 1.1.7
|
version = 1.1.6
|
||||||
author = skullydazed
|
author = skullydazed
|
||||||
author_email = skullydazed@gmail.com
|
author_email = skullydazed@gmail.com
|
||||||
description = A program to help users work with QMK Firmware.
|
description = A program to help users work with QMK Firmware.
|
||||||
@@ -39,6 +39,7 @@ install_requires =
|
|||||||
hid
|
hid
|
||||||
milc>=1.9.0
|
milc>=1.9.0
|
||||||
pyusb
|
pyusb
|
||||||
|
setuptools>=45
|
||||||
# qmk_firmware packages
|
# qmk_firmware packages
|
||||||
dotty-dict
|
dotty-dict
|
||||||
hjson
|
hjson
|
||||||
|
|||||||
Reference in New Issue
Block a user