From dd16f3f0e8c43a53c847cada3a6762fa3bc6f3e5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 16 Sep 2022 16:10:36 +0200 Subject: Merging upstream version 3.1.10 (Closes: #1014035). Signed-off-by: Daniel Baumann --- .env_example | 3 + .travis.yml | 48 ------ CHANGELOG.md | 101 +++++++++++++ LICENSE | 4 +- Pipfile | 16 ++ README.md | 57 ++++++++ README.rst | 162 --------------------- appveyor.yml | 33 ----- build.sh | 10 ++ dead_code/.travis.yml | 49 +++++++ dead_code/README.rst | 162 +++++++++++++++++++++ dead_code/appveyor.yml | 27 ++++ dead_code/setup.py | 109 ++++++++++++++ docs/conf.py | 2 + publish.sh | 1 + pyproject-whl.toml | 66 +++++++++ pyproject.toml | 66 +++++++++ setup.py | 111 -------------- tests/test_all_tables_e2e/test_ascii_table.py | 2 +- tests/test_all_tables_e2e/test_double_table.py | 2 +- .../test_single_table_windows.py | 2 +- .../test_terminal_io/sub_title_ascii_win2012b.bmp | Bin 0 -> 4142 bytes tests/test_terminal_io/sub_title_cjk_win2012b.bmp | Bin 0 -> 9258 bytes tests/test_terminal_io/test_set_terminal_title.py | 6 +- tox.ini | 18 ++- 25 files changed, 687 insertions(+), 370 deletions(-) create mode 100644 .env_example delete mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 Pipfile create mode 100644 README.md delete mode 100644 README.rst delete mode 100644 appveyor.yml create mode 100644 build.sh create mode 100644 dead_code/.travis.yml create mode 100644 dead_code/README.rst create mode 100644 dead_code/appveyor.yml create mode 100644 dead_code/setup.py create mode 100644 publish.sh create mode 100644 pyproject-whl.toml create mode 100644 pyproject.toml delete mode 100755 setup.py create mode 100644 tests/test_terminal_io/sub_title_ascii_win2012b.bmp create mode 100644 tests/test_terminal_io/sub_title_cjk_win2012b.bmp diff --git a/.env_example b/.env_example new file mode 100644 index 0000000..0048805 --- /dev/null +++ b/.env_example @@ -0,0 +1,3 @@ +export PYTHONIOENCODING=utf-8 +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1f9f3ed..0000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Configure. -env: TOX_ENV=py -language: python -matrix: - include: - - python: 3.5 - env: TOX_ENV=lint - after_success: - - echo - - python: 3.5 - env: TOX_ENV=docs - after_success: - - eval "$(ssh-agent -s)"; touch docs/key; chmod 0600 docs/key - - openssl aes-256-cbc -d -K "$encrypted_c89fed6a587d_key" -iv "$encrypted_c89fed6a587d_iv" - < docs/key.enc > docs/key && ssh-add docs/key - - git config --global user.email "builds@travis-ci.com" - - git config --global user.name "Travis CI" - - git remote set-url --push origin "git@github.com:$TRAVIS_REPO_SLUG" - - export ${!TRAVIS*} - - tox -e docsV -python: - - 3.5 - - 3.4 - - 3.3 - - pypy3 - - pypy - - 2.7 - - 2.6 -sudo: false - -# Run. -install: pip install tox -script: tox -e $TOX_ENV -after_success: - - bash <(curl -s https://codecov.io/bash) - -# Deploy. -deploy: - provider: pypi - user: Robpol86 - password: - secure: - "aj+Hl25+NbtmKpHcqxxNJhaMmawgzEPdLX+NwxwAZuTrvUCdiMtYhF9qxN0USHIlXSGDNc\ - 7ua6nNpYPhjRv7j5YM4uLlK+4Fv/iU+iQcVfy89BS4vlXzUoje6nLIhogsxytb+FjdGZ0PK\ - JzzxfYr0relUjui/gPYmTQoZ1IiT8A=" - on: - condition: $TRAVIS_PYTHON_VERSION = 3.4 - tags: true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e8706fe --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,101 @@ + +Changelog +========= + +This project adheres to `Semantic Versioning `_. + +3.1.7 - 2016-12-7 +------------------ + +Added + * Published wheel. Resume maintenance under new developer after main project had been archived. + +3.1.0 - 2016-10-16 +------------------ + +Added + * ``git --porcelain``-like table by liiight: https://github.com/Robpol86/terminaltables/pull/31 + +3.0.0 - 2016-05-30 +------------------ + +Added + * Support for https://pypi.python.org/pypi/colorama + * Support for https://pypi.python.org/pypi/termcolor + * Support for RTL characters (Arabic and Hebrew). + * Support for non-string items in ``table_data`` like integers. + +Changed +- Refactored again, but this time entire project including tests. + +Removed +- ``padded_table_data`` property and ``join_row()``. Moving away from repeated string joining/splitting. + +Fixed + +- ``set_terminal_title()`` Unicode handling on Windows. +- https://github.com/Robpol86/terminaltables/issues/18 +- https://github.com/Robpol86/terminaltables/issues/20 +- https://github.com/Robpol86/terminaltables/issues/23 +- https://github.com/Robpol86/terminaltables/issues/26 + +2.1.0 - 2015-11-02 +------------------ + +Added + * GitHub Flavored Markdown table by bcho: https://github.com/Robpol86/terminaltables/pull/12 + * Python 3.5 support (Linux/OS X and Windows). + +2.0.0 - 2015-10-11 +------------------ + +Changed + * Refactored code. No new features. + * Breaking changes: ``UnixTable``/``WindowsTable``/``WindowsTableDouble`` moved. Use ``SingleTable``/``DoubleTable`` + instead. + +1.2.1 - 2015-09-03 +------------------ + +Fixed + * CJK character width fixed by zqqf16 and bcho: https://github.com/Robpol86/terminaltables/pull/9 + +1.2.0 - 2015-05-31 +------------------ + +Added + * Bottom row separator. + +1.1.1 - 2014-11-03 +------------------ + +Fixed + * Python 2.7 64-bit terminal width bug on Windows. + +1.1.0 - 2014-11-02 +------------------ + +Added + * Windows support. + * Double-lined table. + +1.0.2 - 2014-09-18 +------------------ + +Added + * ``table_width`` and ``ok`` properties. + +1.0.1 - 2014-09-12 +------------------ + +Added + * Terminal width/height defaults for testing. + * ``terminaltables.DEFAULT_TERMINAL_WIDTH`` + * ``terminaltables.DEFAULT_TERMINAL_HEIGHT`` + +1.0.0 - 2014-09-11 +------------------ + +* Initial release. + +.. changelog-section-end diff --git a/LICENSE b/LICENSE index d314c3c..2fc38fa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2016 Robpol86 +Copyright (c) 2017 Robpol86 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..829b4c6 --- /dev/null +++ b/Pipfile @@ -0,0 +1,16 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] +colorama=">=0.3.7" +colorclass=">=2.2.0" +pytest-cov=">=2.4.0" +termcolor = "*" +check-wheel-contents = "*" + +[requires] +python_version = "3.9" diff --git a/README.md b/README.md new file mode 100644 index 0000000..98e626a --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +## terminaltables + +# What is it + +Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows. + +- Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5+ supported on Linux and OS X. +- Python 2.7, 3.3, 3.4, and 3.5+ supported on Windows (both 32 and 64 bit versions of Python). + +📖 Full documentation: https://robpol86.github.io/terminaltables + +Quickstart +========== + +Install: + +```bash +pip install terminaltables +``` + +Usage: + +```python +from terminaltables import AsciiTable + +table_data = [ + ['Heading1', 'Heading2'], + ['row1 column1', 'row1 column2'], + ['row2 column1', 'row2 column2'], + ['row3 column1', 'row3 column2'] +] +table = AsciiTable(table_data) +print +table.table +``` + +```bash ++--------------+--------------+ +| Heading1 | Heading2 | ++--------------+--------------+ +| row1 column1 | row1 column2 | +| row2 column1 | row2 column2 | +| row3 column1 | row3 column2 | ++--------------+--------------+ +``` + +Example Implementations +======================= +![Example Scripts Screenshot](https://github.com/matthewdeanmartin/terminaltables/blob/master/docs/examples.png?raw=true) + +Source code for examples: + +- [example1.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example1.py) +- [example2.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example2.py) +- [example3.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example3.py) + +[Change Log](https://github.com/matthewdeanmartin/terminaltables/blob/master/CHANGELOG.md) \ No newline at end of file diff --git a/README.rst b/README.rst deleted file mode 100644 index fe9044f..0000000 --- a/README.rst +++ /dev/null @@ -1,162 +0,0 @@ -============== -terminaltables -============== - -Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows. - -* Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5 supported on Linux and OS X. -* Python 2.7, 3.3, 3.4, and 3.5 supported on Windows (both 32 and 64 bit versions of Python). - -📖 Full documentation: https://robpol86.github.io/terminaltables - -.. image:: https://img.shields.io/appveyor/ci/Robpol86/terminaltables/master.svg?style=flat-square&label=AppVeyor%20CI - :target: https://ci.appveyor.com/project/Robpol86/terminaltables - :alt: Build Status Windows - -.. image:: https://img.shields.io/travis/Robpol86/terminaltables/master.svg?style=flat-square&label=Travis%20CI - :target: https://travis-ci.org/Robpol86/terminaltables - :alt: Build Status - -.. image:: https://img.shields.io/codecov/c/github/Robpol86/terminaltables/master.svg?style=flat-square&label=Codecov - :target: https://codecov.io/gh/Robpol86/terminaltables - :alt: Coverage Status - -.. image:: https://img.shields.io/pypi/v/terminaltables.svg?style=flat-square&label=Latest - :target: https://pypi.python.org/pypi/terminaltables - :alt: Latest Version - -Quickstart -========== - -Install: - -.. code:: bash - - pip install terminaltables - -Usage: - -.. code:: - - from terminaltables import AsciiTable - table_data = [ - ['Heading1', 'Heading2'], - ['row1 column1', 'row1 column2'], - ['row2 column1', 'row2 column2'], - ['row3 column1', 'row3 column2'] - ] - table = AsciiTable(table_data) - print table.table - +--------------+--------------+ - | Heading1 | Heading2 | - +--------------+--------------+ - | row1 column1 | row1 column2 | - | row2 column1 | row2 column2 | - | row3 column1 | row3 column2 | - +--------------+--------------+ - -Example Implementations -======================= - -.. image:: docs/examples.png?raw=true - :alt: Example Scripts Screenshot - -Source code for examples: `example1.py `_, -`example2.py `_, and -`example3.py `_ - -.. changelog-section-start - -Changelog -========= - -This project adheres to `Semantic Versioning `_. - -3.1.0 - 2016-10-16 ------------------- - -Added - * ``git --porcelain``-like table by liiight: https://github.com/Robpol86/terminaltables/pull/31 - -3.0.0 - 2016-05-30 ------------------- - -Added - * Support for https://pypi.python.org/pypi/colorama - * Support for https://pypi.python.org/pypi/termcolor - * Support for RTL characters (Arabic and Hebrew). - * Support for non-string items in ``table_data`` like integers. - -Changed - * Refactored again, but this time entire project including tests. - -Removed - * ``padded_table_data`` property and ``join_row()``. Moving away from repeated string joining/splitting. - -Fixed - * ``set_terminal_title()`` Unicode handling on Windows. - * https://github.com/Robpol86/terminaltables/issues/18 - * https://github.com/Robpol86/terminaltables/issues/20 - * https://github.com/Robpol86/terminaltables/issues/23 - * https://github.com/Robpol86/terminaltables/issues/26 - -2.1.0 - 2015-11-02 ------------------- - -Added - * GitHub Flavored Markdown table by bcho: https://github.com/Robpol86/terminaltables/pull/12 - * Python 3.5 support (Linux/OS X and Windows). - -2.0.0 - 2015-10-11 ------------------- - -Changed - * Refactored code. No new features. - * Breaking changes: ``UnixTable``/``WindowsTable``/``WindowsTableDouble`` moved. Use ``SingleTable``/``DoubleTable`` - instead. - -1.2.1 - 2015-09-03 ------------------- - -Fixed - * CJK character width fixed by zqqf16 and bcho: https://github.com/Robpol86/terminaltables/pull/9 - -1.2.0 - 2015-05-31 ------------------- - -Added - * Bottom row separator. - -1.1.1 - 2014-11-03 ------------------- - -Fixed - * Python 2.7 64-bit terminal width bug on Windows. - -1.1.0 - 2014-11-02 ------------------- - -Added - * Windows support. - * Double-lined table. - -1.0.2 - 2014-09-18 ------------------- - -Added - * ``table_width`` and ``ok`` properties. - -1.0.1 - 2014-09-12 ------------------- - -Added - * Terminal width/height defaults for testing. - * ``terminaltables.DEFAULT_TERMINAL_WIDTH`` - * ``terminaltables.DEFAULT_TERMINAL_HEIGHT`` - -1.0.0 - 2014-09-11 ------------------- - -* Initial release. - -.. changelog-section-end diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 5b0e517..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Configure. -environment: - PYTHON: Python35 - matrix: - - TOX_ENV: lint - - TOX_ENV: py35 - - TOX_ENV: py34 - - TOX_ENV: py33 - - TOX_ENV: py27 - - TOX_ENV: py - PYTHON: Python35-x64 - - TOX_ENV: py - PYTHON: Python34-x64 - - TOX_ENV: py - PYTHON: Python33-x64 - - TOX_ENV: py - PYTHON: Python27-x64 - -# Run. -init: set PATH=C:\%PYTHON%;C:\%PYTHON%\Scripts;%PATH% -install: - - appveyor DownloadFile https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1 - - ps: .\enable-desktop -build_script: pip install tox -test_script: tox -e %TOX_ENV% -on_success: IF %TOX_ENV% NEQ lint pip install codecov & codecov - -# Post. -# on_finish: https://github.com/Robpol86/terminaltables/issues/30 - #- appveyor PushArtifact test_ascii_table.png https://github.com/Robpol86/terminaltables/issues/30 - #- appveyor PushArtifact test_double_table.png https://github.com/Robpol86/terminaltables/issues/30 - #- appveyor PushArtifact test_single_table.png https://github.com/Robpol86/terminaltables/issues/30 - #- appveyor PushArtifact test_terminal_io.png https://github.com/Robpol86/terminaltables/issues/30 diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..11f20cb --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +echo assuming we still want to support python 2! +export PYTHONPATH=$PYTHONPATH:. +pylint terminaltables +flake8 terminaltables +python -m pytest terminaltables +python -m pytest --doctest-glob="terminaltables/**/*.py" +pytest tests -v --cov-report html:coverage --cov=terminaltables +echo not bumping version here, just checking if we can create the wheel +poetry build +check-wheel-contents dist/*.whl \ No newline at end of file diff --git a/dead_code/.travis.yml b/dead_code/.travis.yml new file mode 100644 index 0000000..02cf421 --- /dev/null +++ b/dead_code/.travis.yml @@ -0,0 +1,49 @@ +# Configure. +language: python +python: + - 3.5 + - 3.4 + - 3.3 + - pypy3 + - pypy + - 2.7 + - 2.6 +sudo: false + +# Environment and matrix. +env: TOX_ENV=py +matrix: + include: + - python: 3.5 + env: TOX_ENV=lint + after_success: [] + - python: 3.5 + env: TOX_ENV=docs + after_success: + - eval "$(ssh-agent -s)"; touch docs/key; chmod 0600 $_ + - openssl aes-256-cbc -d -K "$encrypted_c89fed6a587d_key" -iv "$encrypted_c89fed6a587d_iv" -out docs/key + < docs/key.enc && ssh-add $_ + - git config --global user.email "builds@travis-ci.com" + - git config --global user.name "Travis CI" + - git remote set-url --push origin "git@github.com:$TRAVIS_REPO_SLUG" + - export ${!TRAVIS*} + - tox -e docsV + +# Run. +install: pip install tox +script: tox -e $TOX_ENV +after_success: + - bash <(curl -s https://codecov.io/bash) + +# Deploy. +deploy: + provider: pypi + user: Robpol86 + password: + secure: + "aj+Hl25+NbtmKpHcqxxNJhaMmawgzEPdLX+NwxwAZuTrvUCdiMtYhF9qxN0USHIlXSGDNc\ + 7ua6nNpYPhjRv7j5YM4uLlK+4Fv/iU+iQcVfy89BS4vlXzUoje6nLIhogsxytb+FjdGZ0PK\ + JzzxfYr0relUjui/gPYmTQoZ1IiT8A=" + on: + condition: $TRAVIS_PYTHON_VERSION = 3.4 + tags: true diff --git a/dead_code/README.rst b/dead_code/README.rst new file mode 100644 index 0000000..fe9044f --- /dev/null +++ b/dead_code/README.rst @@ -0,0 +1,162 @@ +============== +terminaltables +============== + +Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows. + +* Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5 supported on Linux and OS X. +* Python 2.7, 3.3, 3.4, and 3.5 supported on Windows (both 32 and 64 bit versions of Python). + +📖 Full documentation: https://robpol86.github.io/terminaltables + +.. image:: https://img.shields.io/appveyor/ci/Robpol86/terminaltables/master.svg?style=flat-square&label=AppVeyor%20CI + :target: https://ci.appveyor.com/project/Robpol86/terminaltables + :alt: Build Status Windows + +.. image:: https://img.shields.io/travis/Robpol86/terminaltables/master.svg?style=flat-square&label=Travis%20CI + :target: https://travis-ci.org/Robpol86/terminaltables + :alt: Build Status + +.. image:: https://img.shields.io/codecov/c/github/Robpol86/terminaltables/master.svg?style=flat-square&label=Codecov + :target: https://codecov.io/gh/Robpol86/terminaltables + :alt: Coverage Status + +.. image:: https://img.shields.io/pypi/v/terminaltables.svg?style=flat-square&label=Latest + :target: https://pypi.python.org/pypi/terminaltables + :alt: Latest Version + +Quickstart +========== + +Install: + +.. code:: bash + + pip install terminaltables + +Usage: + +.. code:: + + from terminaltables import AsciiTable + table_data = [ + ['Heading1', 'Heading2'], + ['row1 column1', 'row1 column2'], + ['row2 column1', 'row2 column2'], + ['row3 column1', 'row3 column2'] + ] + table = AsciiTable(table_data) + print table.table + +--------------+--------------+ + | Heading1 | Heading2 | + +--------------+--------------+ + | row1 column1 | row1 column2 | + | row2 column1 | row2 column2 | + | row3 column1 | row3 column2 | + +--------------+--------------+ + +Example Implementations +======================= + +.. image:: docs/examples.png?raw=true + :alt: Example Scripts Screenshot + +Source code for examples: `example1.py `_, +`example2.py `_, and +`example3.py `_ + +.. changelog-section-start + +Changelog +========= + +This project adheres to `Semantic Versioning `_. + +3.1.0 - 2016-10-16 +------------------ + +Added + * ``git --porcelain``-like table by liiight: https://github.com/Robpol86/terminaltables/pull/31 + +3.0.0 - 2016-05-30 +------------------ + +Added + * Support for https://pypi.python.org/pypi/colorama + * Support for https://pypi.python.org/pypi/termcolor + * Support for RTL characters (Arabic and Hebrew). + * Support for non-string items in ``table_data`` like integers. + +Changed + * Refactored again, but this time entire project including tests. + +Removed + * ``padded_table_data`` property and ``join_row()``. Moving away from repeated string joining/splitting. + +Fixed + * ``set_terminal_title()`` Unicode handling on Windows. + * https://github.com/Robpol86/terminaltables/issues/18 + * https://github.com/Robpol86/terminaltables/issues/20 + * https://github.com/Robpol86/terminaltables/issues/23 + * https://github.com/Robpol86/terminaltables/issues/26 + +2.1.0 - 2015-11-02 +------------------ + +Added + * GitHub Flavored Markdown table by bcho: https://github.com/Robpol86/terminaltables/pull/12 + * Python 3.5 support (Linux/OS X and Windows). + +2.0.0 - 2015-10-11 +------------------ + +Changed + * Refactored code. No new features. + * Breaking changes: ``UnixTable``/``WindowsTable``/``WindowsTableDouble`` moved. Use ``SingleTable``/``DoubleTable`` + instead. + +1.2.1 - 2015-09-03 +------------------ + +Fixed + * CJK character width fixed by zqqf16 and bcho: https://github.com/Robpol86/terminaltables/pull/9 + +1.2.0 - 2015-05-31 +------------------ + +Added + * Bottom row separator. + +1.1.1 - 2014-11-03 +------------------ + +Fixed + * Python 2.7 64-bit terminal width bug on Windows. + +1.1.0 - 2014-11-02 +------------------ + +Added + * Windows support. + * Double-lined table. + +1.0.2 - 2014-09-18 +------------------ + +Added + * ``table_width`` and ``ok`` properties. + +1.0.1 - 2014-09-12 +------------------ + +Added + * Terminal width/height defaults for testing. + * ``terminaltables.DEFAULT_TERMINAL_WIDTH`` + * ``terminaltables.DEFAULT_TERMINAL_HEIGHT`` + +1.0.0 - 2014-09-11 +------------------ + +* Initial release. + +.. changelog-section-end diff --git a/dead_code/appveyor.yml b/dead_code/appveyor.yml new file mode 100644 index 0000000..8b7d1c9 --- /dev/null +++ b/dead_code/appveyor.yml @@ -0,0 +1,27 @@ +# Configure. +environment: + PATH: C:\%PYTHON%;C:\%PYTHON%\Scripts;%PATH% + PYTHON: Python35 + matrix: + - TOX_ENV: lint + - TOX_ENV: py35 + - TOX_ENV: py34 + - TOX_ENV: py33 + - TOX_ENV: py27 + - TOX_ENV: py + PYTHON: Python35-x64 + - TOX_ENV: py + PYTHON: Python34-x64 + - TOX_ENV: py + PYTHON: Python33-x64 + - TOX_ENV: py + PYTHON: Python27-x64 + +# Run. +build_script: pip install tox +test_script: tox -e %TOX_ENV% +on_success: IF %TOX_ENV% NEQ lint pip install codecov & codecov + +# Post. +on_finish: + - FOR %%F IN (test*.png) DO appveyor PushArtifact %%F diff --git a/dead_code/setup.py b/dead_code/setup.py new file mode 100644 index 0000000..a947444 --- /dev/null +++ b/dead_code/setup.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +"""Setup script for the project.""" + +import codecs +import os +import re + +from setuptools import Command, setup + +INSTALL_REQUIRES = [] +LICENSE = 'MIT' +NAME = IMPORT = 'terminaltables' +VERSION = '3.1.0' + + +def readme(path='README.rst'): + """Try to read README.rst or return empty string if failed. + + :param str path: Path to README file. + + :return: File contents. + :rtype: str + """ + path = os.path.realpath(os.path.join(os.path.dirname(__file__), path)) + handle = None + url_prefix = 'https://raw.githubusercontent.com/Robpol86/{name}/v{version}/'.format(name=NAME, version=VERSION) + try: + handle = codecs.open(path, encoding='utf-8') + return handle.read(131072).replace('.. image:: docs', '.. image:: {0}docs'.format(url_prefix)) + except IOError: + return '' + finally: + getattr(handle, 'close', lambda: None)() + + +class CheckVersion(Command): + """Make sure version strings and other metadata match here, in module/package, tox, and other places.""" + + description = 'verify consistent version/etc strings in project' + user_options = [] + + @classmethod + def initialize_options(cls): + """Required by distutils.""" + pass + + @classmethod + def finalize_options(cls): + """Required by distutils.""" + pass + + @classmethod + def run(cls): + """Check variables.""" + project = __import__(IMPORT, fromlist=['']) + for expected, var in [('@Robpol86', '__author__'), (LICENSE, '__license__'), (VERSION, '__version__')]: + if getattr(project, var) != expected: + raise SystemExit('Mismatch: {0}'.format(var)) + # Check changelog. + if not re.compile(r'^%s - \d{4}-\d{2}-\d{2}[\r\n]' % VERSION, re.MULTILINE).search(readme()): + raise SystemExit('Version not found in readme/changelog file.') + # Check tox. + if INSTALL_REQUIRES: + contents = readme('tox.ini') + section = re.compile(r'[\r\n]+install_requires =[\r\n]+(.+?)[\r\n]+\w', re.DOTALL).findall(contents) + if not section: + raise SystemExit('Missing install_requires section in tox.ini.') + in_tox = re.findall(r' ([^=]+)==[\w\d.-]+', section[0]) + if INSTALL_REQUIRES != in_tox: + raise SystemExit('Missing/unordered pinned dependencies in tox.ini.') + + +if __name__ == '__main__': + setup( + author='@Robpol86', + author_email='robpol86@gmail.com', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Environment :: MacOS X', + 'Environment :: Win32 (MS Windows)', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX :: Linux', + 'Operating System :: POSIX', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries', + 'Topic :: Terminals', + 'Topic :: Text Processing :: Markup', + ], + cmdclass=dict(check_version=CheckVersion), + description='Generate simple tables in terminals from a nested list of strings.', + install_requires=INSTALL_REQUIRES, + keywords='Shell Bash ANSI ASCII terminal tables', + license=LICENSE, + long_description=readme(), + name=NAME, + packages=[IMPORT], + url='https://github.com/Robpol86/' + NAME, + version=VERSION, + zip_safe=True, + ) diff --git a/docs/conf.py b/docs/conf.py index fb33f09..0e8b9c0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,6 +9,7 @@ import time sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))) author = '@Robpol86' copyright = '{}, {}'.format(time.strftime('%Y'), author) +html_last_updated_fmt = '%c {}'.format(time.tzname[time.localtime().tm_isdst]) master_doc = 'index' project = __import__('setup').NAME pygments_style = 'friendly' @@ -49,5 +50,6 @@ googleanalytics_id = 'UA-82627369-1' # SCVersioning. scv_banner_greatest_tag = True scv_grm_exclude = ('.gitignore', '.nojekyll', 'README.rst') +scv_overflow = ('-W',) scv_show_banner = True scv_sort = ('semver', 'time') diff --git a/publish.sh b/publish.sh new file mode 100644 index 0000000..8ad6022 --- /dev/null +++ b/publish.sh @@ -0,0 +1 @@ +rm -rf dist && poetry version patch && poetry build && twine upload dist/* diff --git a/pyproject-whl.toml b/pyproject-whl.toml new file mode 100644 index 0000000..3c186b7 --- /dev/null +++ b/pyproject-whl.toml @@ -0,0 +1,66 @@ +[tool.poetry] +name = "terminaltables-whl" +version = "3.1.0" +description = "Generate simple tables in terminals from a nested list of strings." +authors = [ + "Matthew Martin ", + "Robpol86 ", +] +keywords = ["Shell","Bash","ANSI","ASCII","terminal","tables"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: MacOS X", + "Environment :: Win32 (MS Windows)", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries", + "Topic :: Terminals", + "Topic :: Text Processing :: Markup", +] +packages = [ + { include = "terminaltables" }, +] +include = [ + "terminaltables/**/*.py", +] +exclude = [ +] +license = "MIT" +readme = "README.md" +repository = "https://github.com/matthewdeanmartin/terminaltables" +homepage = "https://github.com/matthewdeanmartin/terminaltables" +documentation = "https://github.com/matthewdeanmartin/terminaltables" + +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/matthewdeanmartin/terminaltables/issues" +"Change Log" = "https://github.com/matthewdeanmartin/terminaltables/blob/main/docs/CHANGES.MD" + +[tool.poetry.scripts] + + +[tool.poetry.dependencies] +# per vermin's estimation +python = ">=2.6 || >=3.0" + +[tool.poetry.dev-dependencies] +pytest = "==6.0.1" + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bdcd0ce --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[tool.poetry] +name = "terminaltables" +version = "3.1.10" +description = "Generate simple tables in terminals from a nested list of strings." +authors = [ + "Robpol86 ", + "Matthew Martin " +] +keywords = ["Shell","Bash","ANSI","ASCII","terminal","tables"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: MacOS X", + "Environment :: Win32 (MS Windows)", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries", + "Topic :: Terminals", + "Topic :: Text Processing :: Markup", +] +packages = [ + { include = "terminaltables" }, +] +include = [ + "terminaltables/**/*.py", +] +exclude = [ +] +license = "MIT" +readme = "README.md" +repository = "https://github.com/matthewdeanmartin/terminaltables" +homepage = "https://github.com/matthewdeanmartin/terminaltables" +documentation = "https://github.com/matthewdeanmartin/terminaltables" + +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/matthewdeanmartin/terminaltables/issues" +"Change Log" = "https://github.com/matthewdeanmartin/terminaltables/blob/master/CHANGELOG.md" + +[tool.poetry.scripts] + + +[tool.poetry.dependencies] +# per vermin's estimation +python = ">=2.6 || >=3.0" + +[tool.poetry.dev-dependencies] +pytest = "==6.0.1" + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100755 index 0bc7bf2..0000000 --- a/setup.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -"""Setup script for the project.""" - -from __future__ import print_function - -import codecs -import os -import re - -from setuptools import Command, setup - -INSTALL_REQUIRES = [] -LICENSE = 'MIT' -NAME = IMPORT = 'terminaltables' -VERSION = '3.1.0' - - -def readme(path='README.rst'): - """Try to read README.rst or return empty string if failed. - - :param str path: Path to README file. - - :return: File contents. - :rtype: str - """ - path = os.path.realpath(os.path.join(os.path.dirname(__file__), path)) - handle = None - url_prefix = 'https://raw.githubusercontent.com/Robpol86/{name}/v{version}/'.format(name=NAME, version=VERSION) - try: - handle = codecs.open(path, encoding='utf-8') - return handle.read(131072).replace('.. image:: docs', '.. image:: {0}docs'.format(url_prefix)) - except IOError: - return '' - finally: - getattr(handle, 'close', lambda: None)() - - -class CheckVersion(Command): - """Make sure version strings and other metadata match here, in module/package, tox, and other places.""" - - description = 'verify consistent version/etc strings in project' - user_options = [] - - @classmethod - def initialize_options(cls): - """Required by distutils.""" - pass - - @classmethod - def finalize_options(cls): - """Required by distutils.""" - pass - - @classmethod - def run(cls): - """Check variables.""" - project = __import__(IMPORT, fromlist=['']) - for expected, var in [('@Robpol86', '__author__'), (LICENSE, '__license__'), (VERSION, '__version__')]: - if getattr(project, var) != expected: - raise SystemExit('Mismatch: {0}'.format(var)) - # Check changelog. - if not re.compile(r'^%s - \d{4}-\d{2}-\d{2}[\r\n]' % VERSION, re.MULTILINE).search(readme()): - raise SystemExit('Version not found in readme/changelog file.') - # Check tox. - if INSTALL_REQUIRES: - contents = readme('tox.ini') - section = re.compile(r'[\r\n]+install_requires =[\r\n]+(.+?)[\r\n]+\w', re.DOTALL).findall(contents) - if not section: - raise SystemExit('Missing install_requires section in tox.ini.') - in_tox = re.findall(r' ([^=]+)==[\w\d.-]+', section[0]) - if INSTALL_REQUIRES != in_tox: - raise SystemExit('Missing/unordered pinned dependencies in tox.ini.') - - -if __name__ == '__main__': - setup( - author='@Robpol86', - author_email='robpol86@gmail.com', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Environment :: MacOS X', - 'Environment :: Win32 (MS Windows)', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX :: Linux', - 'Operating System :: POSIX', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries', - 'Topic :: Terminals', - 'Topic :: Text Processing :: Markup', - ], - cmdclass=dict(check_version=CheckVersion), - description='Generate simple tables in terminals from a nested list of strings.', - install_requires=INSTALL_REQUIRES, - keywords='Shell Bash ANSI ASCII terminal tables', - license=LICENSE, - long_description=readme(), - name=NAME, - packages=[IMPORT], - url='https://github.com/Robpol86/' + NAME, - version=VERSION, - zip_safe=True, - ) diff --git a/tests/test_all_tables_e2e/test_ascii_table.py b/tests/test_all_tables_e2e/test_ascii_table.py index 51ebc2a..a1a3b9c 100644 --- a/tests/test_all_tables_e2e/test_ascii_table.py +++ b/tests/test_all_tables_e2e/test_ascii_table.py @@ -100,7 +100,7 @@ def test_multi_line(): @pytest.mark.skipif(str(not IS_WINDOWS)) -@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30 +@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44 def test_windows_screenshot(tmpdir): """Test on Windows in a new console window. Take a screenshot to verify it works. diff --git a/tests/test_all_tables_e2e/test_double_table.py b/tests/test_all_tables_e2e/test_double_table.py index 892357a..beec764 100644 --- a/tests/test_all_tables_e2e/test_double_table.py +++ b/tests/test_all_tables_e2e/test_double_table.py @@ -200,7 +200,7 @@ def test_multi_line(): @pytest.mark.skipif(str(not IS_WINDOWS)) -@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30 +@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44 def test_windows_screenshot(tmpdir): """Test on Windows in a new console window. Take a screenshot to verify it works. diff --git a/tests/test_all_tables_e2e/test_single_table_windows.py b/tests/test_all_tables_e2e/test_single_table_windows.py index a15fa3a..bfdfe2e 100644 --- a/tests/test_all_tables_e2e/test_single_table_windows.py +++ b/tests/test_all_tables_e2e/test_single_table_windows.py @@ -201,7 +201,7 @@ def test_multi_line(): @pytest.mark.skipif(str(not IS_WINDOWS)) -@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30 +@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44 def test_windows_screenshot(tmpdir): """Test on Windows in a new console window. Take a screenshot to verify it works. diff --git a/tests/test_terminal_io/sub_title_ascii_win2012b.bmp b/tests/test_terminal_io/sub_title_ascii_win2012b.bmp new file mode 100644 index 0000000..5c7a484 Binary files /dev/null and b/tests/test_terminal_io/sub_title_ascii_win2012b.bmp differ diff --git a/tests/test_terminal_io/sub_title_cjk_win2012b.bmp b/tests/test_terminal_io/sub_title_cjk_win2012b.bmp new file mode 100644 index 0000000..0606a82 Binary files /dev/null and b/tests/test_terminal_io/sub_title_cjk_win2012b.bmp differ diff --git a/tests/test_terminal_io/test_set_terminal_title.py b/tests/test_terminal_io/test_set_terminal_title.py index 6d58301..38980be 100644 --- a/tests/test_terminal_io/test_set_terminal_title.py +++ b/tests/test_terminal_io/test_set_terminal_title.py @@ -15,7 +15,7 @@ from tests.test_terminal_io import MockKernel32 HERE = py.path.local(__file__).dirpath() - +@pytest.mark.skip("Fails on windows, I didn't touch it") @pytest.mark.parametrize('is_windows', [False, True]) @pytest.mark.parametrize('mode', ['ascii', 'unicode', 'bytes']) def test(monkeypatch, is_windows, mode): @@ -54,8 +54,8 @@ def test(monkeypatch, is_windows, mode): @pytest.mark.skipif(str(not IS_WINDOWS)) -@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30 @pytest.mark.parametrize('mode', ['ascii', 'unicode', 'bytes']) +@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44 def test_windows_screenshot(tmpdir, mode): """Test function on Windows in a new console window. Take a screenshot to verify it works. @@ -65,7 +65,7 @@ def test_windows_screenshot(tmpdir, mode): script = tmpdir.join('script.py') command = [sys.executable, str(script)] change_title = tmpdir.join('change_title') - screenshot = PROJECT_ROOT.join('test_terminal_io.png') + screenshot = PROJECT_ROOT.join('test_terminal_io_{0}.png'.format(mode)) if screenshot.check(): screenshot.remove() diff --git a/tox.ini b/tox.ini index f5b8ad4..ffb40c5 100644 --- a/tox.ini +++ b/tox.ini @@ -28,20 +28,21 @@ commands = flake8 --application-import-names={[general]name},tests pylint --rcfile=tox.ini setup.py {[general]name} deps = - flake8-docstrings==1.0.2 - flake8-import-order==0.9.2 - flake8==3.0.4 + flake8-docstrings==1.0.3 + flake8-import-order==0.12 + flake8==3.3.0 pep8-naming==0.4.1 - pylint==1.6.4 + pydocstyle==1.1.1 + pylint==1.6.5 [testenv:docs] changedir = {toxinidir}/docs commands = - sphinx-build . _build/html {posargs} + sphinx-build -W . _build/html {posargs} deps = robpol86-sphinxcontrib-googleanalytics==0.1 - sphinx-rtd-theme==0.1.10a0 - sphinx==1.4.8 + sphinx-rtd-theme==0.2.4 + sphinx==1.5.3 usedevelop = False [testenv:docsV] @@ -49,13 +50,14 @@ commands = sphinx-versioning push docs gh-pages . deps = {[testenv:docs]deps} - sphinxcontrib-versioning==2.2.0 + sphinxcontrib-versioning==2.2.1 passenv = HOME HOSTNAME SSH_AUTH_SOCK TRAVIS* USER +usedevelop = False [flake8] exclude = .tox/*,build/*,docs/*,env/*,get-pip.py -- cgit v1.2.3