Convert project to a Poetry project
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 14 May 2020 19:22:09 +0000 (15:22 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 22 May 2020 15:08:49 +0000 (11:08 -0400)
Poetry <https://python-poetry.org/> handles the build creation and
`setup.py` and `PKG-INFO` generation.

Poetry also handles dependencies and can create a corresponding virtual
environment having them installed.

Poetry can also publish.

`poetry.lock` was generated by `poetry install` and ensures this
specific version of barectf is tested with those specific versions of
the dependencies.

Setuptools is a run-time dependency for its `pkg_resources` package. I
use `*` for its version constraint because somehow Poetry needs
Setuptools itself so it skips this dependency (see
<https://github.com/python-poetry/poetry/issues/1584>). The `setuptools`
dependency still ends up in `setup.py`.

`tox.ini` is calibrated so that tox doesn't manage any dependency;
everything is done through Poetry (except `flake8` which doesn't need
barectf to be installed).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
poetry.lock [new file with mode: 0644]
pyproject.toml [new file with mode: 0644]
requirements.txt [deleted file]
setup.py [deleted file]
test-requirements.txt [deleted file]
tox.ini

diff --git a/poetry.lock b/poetry.lock
new file mode 100644 (file)
index 0000000..762625a
--- /dev/null
@@ -0,0 +1,37 @@
+[[package]]
+category = "main"
+description = "YAML parser and emitter for Python"
+name = "pyyaml"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+version = "5.3.1"
+
+[[package]]
+category = "main"
+description = "ANSII Color formatting for output in terminal."
+name = "termcolor"
+optional = false
+python-versions = "*"
+version = "1.1.0"
+
+[metadata]
+content-hash = "093137bc1e41045c348580df35966d4e72d29639853f4b642366f856ba62aae7"
+python-versions = '^3.5'
+
+[metadata.files]
+pyyaml = [
+    {file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"},
+    {file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"},
+    {file = "PyYAML-5.3.1-cp35-cp35m-win32.whl", hash = "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2"},
+    {file = "PyYAML-5.3.1-cp35-cp35m-win_amd64.whl", hash = "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c"},
+    {file = "PyYAML-5.3.1-cp36-cp36m-win32.whl", hash = "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2"},
+    {file = "PyYAML-5.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648"},
+    {file = "PyYAML-5.3.1-cp37-cp37m-win32.whl", hash = "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a"},
+    {file = "PyYAML-5.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf"},
+    {file = "PyYAML-5.3.1-cp38-cp38-win32.whl", hash = "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97"},
+    {file = "PyYAML-5.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee"},
+    {file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"},
+]
+termcolor = [
+    {file = "termcolor-1.1.0.tar.gz", hash = "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"},
+]
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644 (file)
index 0000000..47a85b4
--- /dev/null
@@ -0,0 +1,68 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+[build-system]
+requires = ['poetry>=0.12']
+build-backend = 'poetry.masonry.api'
+
+[tool.poetry]
+name = 'barectf'
+version = '2.3.1'
+description = 'Generator of ANSI C tracers which output CTF'
+license = 'MIT'
+authors = ['Philippe Proulx <eeppeliteloop@gmail.com>']
+readme = 'README.md'
+homepage = 'https://barectf.org/'
+repository = 'https://github.com/efficios/barectf/'
+keywords = [
+    'ctf',
+    'generator',
+    'tracing',
+    'bare-metal',
+    'bare-machine',
+]
+classifiers = [
+    'Development Status :: 6 - Mature',
+    'Environment :: Console',
+    'Intended Audience :: Developers',
+    'License :: OSI Approved :: MIT License',
+    'Natural Language :: English',
+    'Operating System :: OS Independent',
+    'Programming Language :: C',
+    'Topic :: Software Development :: Code Generators',
+]
+packages = [{include = 'barectf'}]
+
+[tool.poetry.dependencies]
+python = '^3.5'
+termcolor = '^1.1'
+pyyaml = '^5.3'
+setuptools = '*'
+
+[tool.poetry.scripts]
+barectf = 'barectf.cli:run'
+
+[tool.poetry.urls]
+'Bug tracker' = 'https://github.com/efficios/barectf/issues/'
+'Code review' = 'https://review.lttng.org/admin/repos/barectf'
+'Continuous integration' = 'https://ci.lttng.org/job/barectf_master_build/'
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644 (file)
index 9d63f29..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-termcolor
-pyyaml
diff --git a/setup.py b/setup.py
deleted file mode 100755 (executable)
index 47679b9..0000000
--- a/setup.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python3
-#
-# The MIT License (MIT)
-#
-# Copyright (c) 2014-2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-from setuptools import setup
-import sys
-
-
-def _check_python3():
-  # make sure we run Python 3+ here
-  v = sys.version_info
-
-  if v.major < 3:
-      sys.stderr.write('Sorry, barectf needs Python 3\n')
-      sys.exit(1)
-
-
-_check_python3()
-
-
-import barectf
-
-
-setup(name='barectf',
-      version=barectf.__version__,
-      description='Generator of ANSI C tracers which output CTF',
-      author='Philippe Proulx',
-      author_email='eeppeliteloop@gmail.com',
-      license='MIT',
-      keywords='ctf generator tracing bare-metal bare-machine',
-      url='http://barectf.org',
-      packages=[
-          'barectf',
-      ],
-      package_data={
-          'barectf': [
-              'include/*.yaml',
-          ],
-      },
-      install_requires=[
-          'termcolor',
-          'pyyaml',
-      ],
-      entry_points={
-          'console_scripts': [
-              'barectf = barectf.cli:run'
-          ],
-      })
diff --git a/test-requirements.txt b/test-requirements.txt
deleted file mode 100644 (file)
index efb4092..0000000
+++ /dev/null
@@ -1 +0,0 @@
-flake8>=2.5.0
diff --git a/tox.ini b/tox.ini
index 5cfe94aa6a8fe2c1dd053e13917a97e7cac2b67b..c0173ebe4d9922df0e6a3e02da0e770d63dc2609 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,28 +1,26 @@
 [tox]
-minversion = 1.9
+minversion = 3.3
+isolated_build = true
 envlist = tests
 skipsdist = True
-toxworkdir = {env:TOXWORKDIR:.tox}
 
 [testenv]
-setenv =
-       PYTHONPATH = {env:PYTHONPATH:}
-deps = -r{toxinidir}/requirements.txt
-       -r{toxinidir}/test-requirements.txt
-usedevelop = true
-whitelist_externals = bash
+whitelist_externals = poetry
+passenv = TERM TERMINFO
 
 [testenv:tests]
 changedir = tests
-commands = bash ./test.bash -t
+commands =
+    poetry install -v
+    poetry run bash ./test.bash -t
 
 [testenv:pep8]
+deps = flake8 >= 2.5
 commands = flake8
 
 [flake8]
 # E123, E125 skipped as they are invalid PEP-8.
 # also ignore E501 because barectf has very long lines
-
 show-source = True
 ignore = E123,E125,E501
 builtins = _
@@ -30,12 +28,18 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
 
 [testenv:pylint-errors]
 deps = pylint >= 1.6
-commands = pylint -f colorized -E barectf
+commands =
+    poetry install -v
+    poetry run pylint -f colorized -E barectf
 
 [testenv:pylint-warnings]
 deps = pylint >= 1.6
-commands = pylint -f colorized -d all -e W -r n barectf
+commands =
+    poetry install -v
+    poetry run pylint -f colorized -d all -e W -r n barectf
 
 [testenv:pylint-full]
 deps = pylint >= 1.6
-commands = pylint -f colorized --disable=all -e R,E,W barectf
+commands =
+    poetry install -v
+    poetry run pylint -f colorized --disable=all -e R,E,W barectf
This page took 0.038886 seconds and 4 git commands to generate.