Skip to content

Commit

Permalink
Support Python 3.11 and 3.12 (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
rustydb authored Nov 7, 2024
2 parents 4acc980 + d46600e commit 32870d4
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2023-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the 'Software'),
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
name: Lint
strategy:
matrix:
version: ['3.10', '3.9']
version: ['3.12', '3.11', '3.10', '3.9']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2023-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the 'Software'),
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
name: Tests and Coverage
strategy:
matrix:
version: ['3.10', '3.9']
version: ['3.12', '3.11', '3.10', '3.9']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -52,7 +52,7 @@ jobs:
integration_tests:
strategy:
matrix:
version: ['3.10', '3.9']
version: ['3.12', '3.11', '3.10', '3.9']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
26 changes: 14 additions & 12 deletions Jenkinsfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
*/
@Library('csm-shared-library') _

/* TODO:
While we use pyinstaller and build for noos, continue using 3.10 or older in order for canu to work on RPM-based
distros with older glibc.
*/
def pythonVersion = '3.10'
def pythonImage = 'artifactory.algol60.net/csm-docker/stable/csm-docker-sle-python'

// Disable pr-merge builds; not used.
Expand Down Expand Up @@ -59,6 +64,7 @@ pipeline {
NAME = getRepoName()
VERSION = ''
PRIMARY_NODE = "${env.NODE_NAME}"
PYTHON_VERSION = "${pythonVersion}"
}

stages {
Expand All @@ -70,21 +76,17 @@ pipeline {
name 'ARCH'
values 'x86_64'
}
axis {
name 'PYTHON_VERSION'
values '3.10', '3.9'
}
}
environment {
DOCKER_ARCH = sh(returnStdout: true, script: "[ ${ARCH} == 'x86_64' ] && echo -n 'amd64' || echo -n 'arm64'")
BUILD_DIR = "${env.WORKSPACE}/dist/rpmbuild/${ARCH}/${PYTHON_VERSION}"
BUILD_DIR = "${env.WORKSPACE}/dist/rpmbuild/${ARCH}/${pythonVersion}"
}
stages {
stage('Build: setup') {
steps {
lock('docker-image-pull') {
sh "docker pull --platform linux/${DOCKER_ARCH} ${pythonImage}:${PYTHON_VERSION}"
sh "docker tag ${pythonImage}:${PYTHON_VERSION} ${pythonImage}:${PYTHON_VERSION}-${DOCKER_ARCH}"
sh "docker pull --platform linux/${DOCKER_ARCH} ${pythonImage}:${pythonVersion}"
sh "docker tag ${pythonImage}:${pythonVersion} ${pythonImage}:${pythonVersion}-${DOCKER_ARCH}"
}
}
}
Expand All @@ -94,7 +96,7 @@ pipeline {
label "${PRIMARY_NODE}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${pythonImage}:${PYTHON_VERSION}-${DOCKER_ARCH}"
image "${pythonImage}:${pythonVersion}-${DOCKER_ARCH}"
}
}
steps {
Expand All @@ -121,7 +123,7 @@ pipeline {
label "${PRIMARY_NODE}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${pythonImage}:${PYTHON_VERSION}-${DOCKER_ARCH}"
image "${pythonImage}:${pythonVersion}-${DOCKER_ARCH}"
}
}
steps {
Expand All @@ -137,7 +139,7 @@ pipeline {
label "${PRIMARY_NODE}"
reuseNode true
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh --platform linux/${DOCKER_ARCH}"
image "${pythonImage}:${PYTHON_VERSION}-${DOCKER_ARCH}"
image "${pythonImage}:${pythonVersion}-${DOCKER_ARCH}"
}
}
steps {
Expand All @@ -147,14 +149,14 @@ pipeline {
component: env.NAME,
isStable: isStable,
os: "noos",
pattern: "dist/rpmbuild/${ARCH}/${PYTHON_VERSION}/RPMS/${ARCH}/*.rpm",
pattern: "dist/rpmbuild/${ARCH}/${pythonVersion}/RPMS/${ARCH}/*.rpm",
)
publishCsmRpms(
arch: "src",
component: env.NAME,
isStable: isStable,
os: "noos",
pattern: "dist/rpmbuild/${ARCH}/${PYTHON_VERSION}/SRPMS/*.rpm",
pattern: "dist/rpmbuild/${ARCH}/${pythonVersion}/SRPMS/*.rpm",
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export ARCH := x86_64
endif

ifeq ($(PYTHON_VERSION),)
export PYTHON_VERSION := 3.10
export PYTHON_VERSION := 3.12
endif

export PYTHON_BIN := python$(PYTHON_VERSION)
Expand Down
6 changes: 3 additions & 3 deletions canu/generate/switch/config/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -1685,11 +1685,11 @@ def switch_is_primary(switch):

if int(digits) % 2 == 0: # Switch is Secondary
is_primary = False
primary = f"sw-{middle.rstrip('-')}-{int(digits)-1 :03d}"
primary = f"sw-{middle.rstrip('-')}-{int(digits) - 1 :03d}"
secondary = switch
else: # Switch is Primary
is_primary = True
secondary = f"sw-{middle.rstrip('-')}-{int(digits)+1 :03d}"
secondary = f"sw-{middle.rstrip('-')}-{int(digits) + 1 :03d}"
primary = switch

return is_primary, primary, secondary
Expand Down
2 changes: 1 addition & 1 deletion canu/validate/shcd/shcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ def print_node_list(node_list, title, out="-"):
if len(unused_block) == 1:
port_string = f"{unused_block[0]:02}==>UNUSED"
else:
port_string = f"{unused_block[0]:02}-{unused_block[len(unused_block)-1]:02}==>UNUSED"
port_string = f"{unused_block[0]:02}-{unused_block[len(unused_block) - 1]:02}==>UNUSED"
unused_block = [] # reset
click.secho(f" {port_string}", fg="green", file=out)

Expand Down
2 changes: 1 addition & 1 deletion network_modeling/NetworkNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def connect(
if index > len(self.__ports) - 1 or index < 0:
raise Exception(
f"{__name__} Port {src_port.port()} was requested from {self.__id}:{self.__common_name} "
f"but only {len(self.__ports)-1} Ports are available on the Node.",
f"but only {len(self.__ports) - 1} Ports are available on the Node.",
)

if self.__ports[index] is not None:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ classifiers = [
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
description = 'CSM Automatic Network Utility'
dependencies = [
Expand Down

0 comments on commit 32870d4

Please sign in to comment.