Skip to content

Commit

Permalink
python2 cleanup (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerlz authored Jan 21, 2025
1 parent 2ac98c3 commit 6fcb359
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 119 deletions.
6 changes: 3 additions & 3 deletions docs/Packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ are as follows:

Kalico uses a C module to handle some kinematics calculations more quickly.
This module needs to be compiled at packaging time to avoid introducing a
runtime dependency on a compiler. To compile the C module, run `python2
runtime dependency on a compiler. To compile the C module, run `python3
klippy/chelper/__init__.py`.

## Compiling python code

Many distributions have a policy of compiling all python code before packaging
to improve startup time. You can do this by running `python2 -m compileall
to improve startup time. You can do this by running `python3 -m compileall
klippy`.

## Versioning

If you are building a package of Kalico from git, it is usual practice not to
ship a .git directory, so the versioning must be handled without git. To do
this, use the script shipped in `scripts/make_version.py` which should be run as
follows: `python2 scripts/make_version.py YOURDISTRONAME > klippy/.version`.
follows: `python3 scripts/make_version.py YOURDISTRONAME > klippy/.version`.

## Sample packaging script

Expand Down
2 changes: 1 addition & 1 deletion scripts/buildcommands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Script to handle build time requests embedded in C code.
#
# Copyright (C) 2016-2024 Kevin O'Connor <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/canbus_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Tool to query CAN bus uuids
#
# Copyright (C) 2021 Kevin O'Connor <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/checkstack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Script that tries to find how much stack space each function in an
# object is using.
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Script to implement a test console with firmware over serial port
#
# Copyright (C) 2016-2021 Kevin O'Connor <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/graph_temp_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Tool to graph temperature sensor ADC resolution
#
# Copyright (C) 2020 Kevin O'Connor <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ KLIPPER_GROUP=$KLIPPER_USER
install_packages()
{
# Packages for python cffi
PKGLIST="python2-virtualenv libffi base-devel"
PKGLIST="python3-virtualenv libffi base-devel"
# kconfig requirements
PKGLIST="${PKGLIST} ncurses"
# hub-ctrl
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ create_virtualenv()
report_status "Updating python virtual environment..."

# Create virtualenv if it doesn't already exist
[ ! -d ${PYTHONDIR} ] && virtualenv -p python2 ${PYTHONDIR}
[ ! -d ${PYTHONDIR} ] && virtualenv -p python3 ${PYTHONDIR}

# Install/update dependencies
${PYTHONDIR}/bin/pip install -r ${SRCDIR}/scripts/klippy-requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions scripts/install-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ KLIPPER_GROUP=$KLIPPER_USER
install_packages()
{
# Packages for python cffi
PKGLIST="virtualenv python-dev libffi-dev build-essential"
PKGLIST="virtualenv python3-dev libffi-dev build-essential"
# kconfig requirements
PKGLIST="${PKGLIST} libncurses-dev"
# hub-ctrl
Expand All @@ -37,7 +37,7 @@ create_virtualenv()
report_status "Updating python virtual environment..."

# Create virtualenv if it doesn't already exist
[ ! -d ${PYTHONDIR} ] && virtualenv -p python2 ${PYTHONDIR}
[ ! -d ${PYTHONDIR} ] && virtualenv -p python3 ${PYTHONDIR}

# Install/update dependencies
${PYTHONDIR}/bin/pip install -r ${SRCDIR}/scripts/klippy-requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions scripts/install-octopi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PYTHONDIR="${HOME}/klippy-env"
install_packages()
{
# Packages for python cffi
PKGLIST="virtualenv python-dev libffi-dev build-essential"
PKGLIST="virtualenv python3-dev libffi-dev build-essential"
# kconfig requirements
PKGLIST="${PKGLIST} libncurses-dev"
# hub-ctrl
Expand All @@ -34,7 +34,7 @@ create_virtualenv()
report_status "Updating python virtual environment..."

# Create virtualenv if it doesn't already exist
[ ! -d ${PYTHONDIR} ] && virtualenv -p python2 ${PYTHONDIR}
[ ! -d ${PYTHONDIR} ] && virtualenv -p python3 ${PYTHONDIR}

# Install/update dependencies
${PYTHONDIR}/bin/pip install -r ${SRCDIR}/scripts/klippy-requirements.txt
Expand Down
102 changes: 0 additions & 102 deletions scripts/install-ubuntu-18.04.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/make_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Get the version number for klippy
#
# Copyright (C) 2018 Lucas Fink <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/stepstats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Script to calculate stats for each stepper from a log of messages
#
# Copyright (C) 2016 Kevin O'Connor <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion scripts/whconsole.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Test console for webhooks interface
#
# Copyright (C) 2020 Kevin O'Connor <[email protected]>
Expand Down

0 comments on commit 6fcb359

Please sign in to comment.