Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for python 3.13 #685

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charmtools/diff_match_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ def patch_fromText(self, textline):
return patches
text = textline.split('\n')
while len(text) != 0:
m = re.match("^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$", text[0])
m = re.match(r"^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$", text[0])
if not m:
raise ValueError("Invalid patch string: " + text[0])
patch = patch_obj()
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[project]
name = "charm-tools"
description = "Tools for building and maintaining Juju charms"
readme = "README.rst"
maintainers = [{ name = "Cory Johns", email = "johnsca@gmail.com" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python",
]
dependencies = [
"blessings<2.0",
"colander<1.9",
"ct3>=3.0.0,<4.0",
"dict2colander==0.2",
"jsonschema<4.18.0",
"jujubundlelib<0.6",
"keyring<24",
"otherstuf<=1.1.0",
"path<17",
"pathspec<0.11;python_version >= '3.7'",
"pathspec<=0.3.4;python_version < '3.7'",
"pip>=1.5.4",
"pyyaml>=5.0,!=5.4.0,!=5.4.1,!=6.0,<7.0",
"requests>=2.0.0,<3.0.0",
"requirements-parser<0.6",
"ruamel.yaml<0.16.0;python_version < '3.7'",
"ruamel.yaml<0.18;python_version >= '3.7'",
"secretstorage<3.4",
"vergit>=1.0.0,<2.0.0",
"virtualenv>=1.11.4,<21",
]
license = { text = "GPL v3" }
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/juju/charm-tools"

[project.scripts]
charm-build = "charmtools.build.builder:main"
charm-create = "charmtools.create:main"
charm-help = "charmtools.cli:usage"
charm-layers = "charmtools.build.builder:inspect"
charm-proof = "charmtools.proof:main"
charm-pull-source = "charmtools.pullsource:main"
charm-version = "charmtools.version:main"

[project.entry-points."charmtools.templates"]
ansible = "charmtools.templates.ansible:AnsibleCharmTemplate"
bash = "charmtools.templates.bash:BashCharmTemplate"
chef = "charmtools.templates.chef:ChefCharmTemplate"
powershell = "charmtools.templates.powershell:PowerShellCharmTemplate"
python = "charmtools.templates.python_services:PythonServicesCharmTemplate"
python-basic = "charmtools.templates.python:PythonCharmTemplate"
reactive-bash = "charmtools.templates.reactive_bash:ReactiveBashCharmTemplate"
reactive-python = "charmtools.templates.reactive_python:ReactivePythonCharmTemplate"

[tool.setuptools.packages.find]
exclude = ["*tests*"]

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
60 changes: 1 addition & 59 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess
import sys
import json
from setuptools import setup, find_packages
from setuptools import setup


curdir = os.path.dirname(__file__)
Expand Down Expand Up @@ -37,63 +37,5 @@


setup(
name='charm-tools',
version=version,
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=[
'cheetah3>=3.0.0,<4.0',
'pyyaml>=5.0,!=5.4.0,!=5.4.1,!=6.0,<7.0',
'requests>=2.0.0,<3.0.0',
'blessings<2.0',
'ruamel.yaml<0.16.0;python_version < "3.7"',
'pathspec<=0.3.4;python_version < "3.7"',
'ruamel.yaml<0.18;python_version >= "3.7"',
'pathspec<0.11;python_version >= "3.7"',
'otherstuf<=1.1.0',
'path<17',
'pip>=1.5.4',
'jujubundlelib<0.6',
'virtualenv>=1.11.4,<21',
'colander<1.9',
'jsonschema<4.18.0',
'keyring<24',
'secretstorage<3.4',
'dict2colander==0.2',
'vergit>=1.0.0,<2.0.0',
'requirements-parser<0.6',
],
include_package_data=True,
maintainer='Cory Johns',
maintainer_email='johnsca@gmail.com',
description=('Tools for building and maintaining Juju charms'),
long_description=readme,
license='GPL v3',
url='https://github.com/juju/charm-tools',
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python",
],
entry_points={
'console_scripts': [
'charm-build = charmtools.build.builder:main',
'charm-create = charmtools.create:main',
'charm-help = charmtools.cli:usage',
'charm-layers = charmtools.build.builder:inspect',
'charm-proof = charmtools.proof:main',
'charm-pull-source = charmtools.pullsource:main',
'charm-version = charmtools.version:main',
],
'charmtools.templates': [
'bash = charmtools.templates.bash:BashCharmTemplate',
'reactive-python = charmtools.templates.reactive_python:ReactivePythonCharmTemplate', # noqa: E501
'reactive-bash = charmtools.templates.reactive_bash:ReactiveBashCharmTemplate', # noqa: E501
'python-basic = charmtools.templates.python:PythonCharmTemplate',
'python = charmtools.templates.python_services:PythonServicesCharmTemplate', # noqa: E501
'ansible = charmtools.templates.ansible:AnsibleCharmTemplate',
'chef = charmtools.templates.chef:ChefCharmTemplate',
'powershell = charmtools.templates.powershell:PowerShellCharmTemplate', # noqa: E501
]
},
)
2 changes: 1 addition & 1 deletion tests/layers/mysql/hooks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def migrate_to_mount(new_path):
raise RuntimeError('Persistent storage contains old data. '
'Please investigate and migrate data manually '
'to: {}'.format(new_path))
os.chmod(new_path, 0700)
os.chmod(new_path, 0o0700)
if os.path.isdir('/etc/apparmor.d/local'):
render('apparmor.j2', '/etc/apparmor.d/local/usr.sbin.mysqld',
context={'path': os.path.join(new_path, '')})
Expand Down
2 changes: 1 addition & 1 deletion tests/layers/mysql/hooks/nrpe_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def nagios_password():
password = str(uuid.uuid4())
with open(PASSFILE, 'w') as f:
f.write(password)
os.chmod(PASSFILE, 0600)
os.chmod(PASSFILE, 0o0600)
else:
with open(PASSFILE, 'r') as rpw:
password = rpw.read()
Expand Down
2 changes: 1 addition & 1 deletion tests/layers/mysql/scripts/charm_helpers_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def sync_helpers(include, src, dest, options=None):
checkout = clone_helpers(tmpd, config['branch'])
sync_helpers(config['include'], checkout, config['destination'],
options=sync_options)
except Exception, e:
except Exception as e:
logging.error("Could not sync: %s" % e)
raise e
finally:
Expand Down