Sfoglia il codice sorgente

python: Port setuptools to pyproject.toml

Signed-off-by: Manatsawin Hanmongkolchai <git@whs.in.th>
Manatsawin Hanmongkolchai 5 mesi fa
parent
commit
1f4ec5301b

+ 14 - 0
python_libs/pbl/pyproject.toml

@@ -0,0 +1,14 @@
+[project]
+name = "pbl-tool"
+version = "1.0.1"
+description = "Internal tool for interacting with pebbles."
+readme = "README.md"
+requires-python = ">=3.9"
+dependencies = [
+	# This doesn't install in Python 3
+	# "pebble_tool @ git+https://github.com/pebble/pebble-tool.git",
+	"libpebble2[pulse]>=0.0.23",
+]
+
+[project.scripts]
+pbl = "pbl:run_tool"

+ 0 - 30
python_libs/pbl/setup.py

@@ -1,30 +0,0 @@
-__author__ = 'katharine'
-
-import sys
-from setuptools import setup, find_packages
-
-requires = [
-    'pebble_tool==4.4-dp2',
-    'libpebble2[pulse]>=0.0.23',
-]
-
-if sys.version_info < (3, 4, 0):
-    requires.append('enum34==1.0.4')
-
-__version__ = None  # Overwritten by executing version.py.
-with open('pbl/version.py') as f:
-    exec(f.read())
-
-setup(name='pbl-tool',
-      version=__version__,
-      description='Internal tool for interacting with pebbles.',
-      url='https://github.com/pebble/pbl',
-      author='Pebble Technology Corporation',
-      author_email='katharine@pebble.com',
-      license='MIT',
-      packages=find_packages(),
-      install_requires=requires,
-      entry_points={
-          'console_scripts': ['pbl=pbl:run_tool'],
-      },
-      zip_safe=False)

+ 1 - 0
python_libs/pblconvert/.gitignore

@@ -5,3 +5,4 @@ build
 dist
 pblconvert.egg-info
 .DS_Store
+.pytest_cache

+ 2 - 2
python_libs/pblconvert/pblconvert/__main__.py

@@ -4,5 +4,5 @@
 """executed when directory is called as script."""
 
 
-from pblconvert import main
-main()
+from .pblconvert import main
+main()

+ 18 - 0
python_libs/pblconvert/pyproject.toml

@@ -0,0 +1,18 @@
+[project]
+name = "pblconvert"
+version = "0.0.2"
+description = "Tools to convert files into valid Pebble resources"
+readme = "README.rst"
+requires-python = ">=3.9"
+dependencies = [
+	"lxml==3.4.4",
+	"cairosvg",
+	"mock",
+	"Pillow",
+]
+
+[project.scripts]
+pblconvert = "pblconvert.pblconvert:main"
+
+[tool.setuptools]
+packages = ["pblconvert"]

+ 0 - 3
python_libs/pblconvert/requirements.txt

@@ -1,3 +0,0 @@
---index-url https://pypi.python.org/simple/
-
--e .

+ 0 - 26
python_libs/pblconvert/setup.py

@@ -1,26 +0,0 @@
-from setuptools import setup, find_packages
-
-__version__= None  # Overwritten by executing version.py.
-with open('pblconvert/version.py') as f:
-    exec(f.read())
-
-requires = [
-    'lxml==3.4.4',
-    'cairosvg',
-    'mock',
-    'Pillow',
-]
-
-setup(name='pblconvert',
-      version=__version__,
-      description='Tools to convert files into valid Pebble resources',
-      long_description=open('README.rst').read(),
-      url='https://github.com/pebble/pblconvert',
-      author='Pebble Technology Corporation',
-      license='MIT',
-      packages=find_packages(exclude=['tests', 'tests.*']),
-      package_data={'': ['bin/*']},
-      entry_points={'console_scripts': ['pblconvert = pblconvert.pblconvert:main']},
-      install_requires=requires,
-      test_suite='nose.collector',
-)

+ 19 - 0
python_libs/pblprog/pyproject.toml

@@ -0,0 +1,19 @@
+[project]
+name = "pebble.programmer"
+version = "0.0.3"
+description = "Pebble Programmer"
+readme = "README.md"
+requires-python = ">=3.9"
+dependencies = [
+	"intelhex>=2.1,<3",
+	"pyftdi",
+]
+
+[project.entry-points."pebble.programmer"]
+targets = "loader.bin"
+
+[project.scripts]
+pblprog = "pebble.programmer.__main__:main"
+
+[tool.setuptools]
+packages = ["pebble"]

+ 0 - 44
python_libs/pblprog/setup.py

@@ -1,44 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Always prefer setuptools over distutils
-from setuptools import setup, find_packages
-
-setup(
-    name='pebble.programmer',
-    version='0.0.3',
-    description='Pebble Programmer',
-    url='https://github.com/pebble/pblprog',
-    author='Pebble Technology Corporation',
-    author_email='liam@pebble.com',
-
-    packages=find_packages(exclude=['contrib', 'docs', 'tests']),
-    namespace_packages=['pebble'],
-
-    install_requires=[
-        'intelhex>=2.1,<3',
-        'pyftdi'
-    ],
-
-    package_data={
-        'pebble.programmer.targets': ['loader.bin']
-    },
-
-    entry_points={
-        'console_scripts': [
-            'pblprog = pebble.programmer.__main__:main',
-        ],
-    },
-    zip_safe=False
-)

+ 19 - 0
python_libs/pebble-commander/pyproject.toml

@@ -0,0 +1,19 @@
+[project]
+name = "pebble.commander"
+version = "0.0.11"
+description = "Pebble Commander"
+readme = "README.rst"
+# Currently it doesn't run on Python 3
+# requires-python = ">=3.9"
+dependencies = [
+	"pebble.pulse2>=0.0.7,<1",
+]
+
+[project.optional-dependencies]
+Interactive = [
+	"pebble.loghash>=2.6",
+	"prompt_toolkit>=0.55",
+]
+
+[project.scripts]
+pebble-commander = "pebble.commander.__main__:main [Interactive]"

+ 0 - 56
python_libs/pebble-commander/setup.py

@@ -1,56 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Always prefer setuptools over distutils
-from setuptools import setup, find_packages
-# To use a consistent encoding
-from codecs import open
-from os import path
-import sys
-
-here = path.abspath(path.dirname(__file__))
-
-# Get the long description from the README file
-with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
-    long_description = f.read()
-
-setup(
-    name='pebble.commander',
-    version='0.0.11',
-    description='Pebble Commander',
-    long_description=long_description,
-    url='https://github.com/pebble/pebble-commander',
-    author='Pebble Technology Corporation',
-    author_email='cory@pebble.com',
-
-    packages=find_packages(exclude=['contrib', 'docs', 'tests']),
-    namespace_packages = ['pebble'],
-
-    install_requires=[
-        'pebble.pulse2>=0.0.7,<1',
-    ],
-
-    extras_require = {
-        'Interactive': [
-            'pebble.loghash>=2.6',
-            'prompt_toolkit>=0.55',
-        ],
-    },
-
-    entry_points={
-        'console_scripts': [
-            'pebble-commander = pebble.commander.__main__:main [Interactive]',
-        ],
-    },
-)

+ 7 - 0
python_libs/pebble-loghash/pyproject.toml

@@ -0,0 +1,7 @@
+[project]
+name = "pebble.loghash"
+version = "2.6.0"
+description = "Pebble Log Hashing module"
+readme = "README.md"
+requires-python = ">=3.9"
+dependencies = []

+ 0 - 33
python_libs/pebble-loghash/setup.py

@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2025 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""
-Setup.py for distutils
-"""
-
-from setuptools import setup, find_packages
-
-setup(
-    name='pebble.loghash',
-    version='2.6.0',
-    description='Pebble Log Hashing module',
-    author='Pebble Technology Corp',
-    author_email='francois@pebble.com',
-    url='https://github.com/pebble/pyegg-pebble-loghash',
-    namespace_packages = ['pebble'],
-    packages = find_packages()
-)
-

+ 1 - 0
python_libs/pulse2/.gitignore

@@ -23,6 +23,7 @@ var/
 *.egg-info/
 .installed.cfg
 *.egg
+.pytest_cache
 
 # PyInstaller
 #  Usually these files are written by a python script from a template

+ 21 - 0
python_libs/pulse2/pyproject.toml

@@ -0,0 +1,21 @@
+[project]
+name = "pebble.pulse2"
+version = "0.0.7"
+description = "Python tools for connecting to PULSEv2 links"
+readme = "README.rst"
+requires-python = ">=3.9"
+dependencies = [
+	"cobs",
+	"construct>=2.5.3,<2.8",
+	"pyserial",
+	"transitions==0.4.1",
+	"enum34; python_version < \"3.4.0\"",
+]
+
+[project.optional-dependencies]
+dev = [
+	"mock>=2.0.0; python_version < \"3.3.0\"",
+]
+
+[tool.setuptools]
+packages = ["pebble"]

+ 0 - 60
python_libs/pulse2/setup.py

@@ -1,60 +0,0 @@
-# Copyright 2024 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Always prefer setuptools over distutils
-from setuptools import setup, find_packages
-# To use a consistent encoding
-from codecs import open
-from os import path
-import sys
-
-here = path.abspath(path.dirname(__file__))
-
-# Get the long description from the README file
-with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
-    long_description = f.read()
-
-requires = [
-        'cobs',
-        'construct>=2.5.3,<2.8',
-        'pyserial',
-        'transitions==0.4.1',
-]
-
-test_requires = []
-
-if sys.version_info < (3, 3, 0):
-    test_requires.append('mock>=2.0.0')
-if sys.version_info < (3, 4, 0):
-    requires.append('enum34')
-
-setup(
-    name='pebble.pulse2',
-    version='0.0.7',
-    description='Python tools for connecting to PULSEv2 links',
-    long_description=long_description,
-    url='https://github.com/pebble/pulse2',
-    author='Pebble Technology Corporation',
-    author_email='cory@pebble.com',
-
-    packages=find_packages(exclude=['contrib', 'docs', 'tests']),
-    namespace_packages = ['pebble'],
-
-    install_requires=requires,
-
-    extras_require={
-        'test': test_requires,
-    },
-    test_suite = 'tests',
-)