From 5a09cb5a0dab12dedc2d19a6c2798949114f06e2 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 13 Jan 2025 00:50:14 +0300 Subject: [PATCH 1/1] Initial commit - created the project --- .gitattributes | 1 + .github/workflows/test-publish.yaml | 112 ++++++++++++++++++ .gitignore | 10 ++ README.rst | 11 ++ .../requirements/requirements_tests.txt | 2 + devscripts/requirements/requirements_tox.txt | 1 + setup.cfg | 11 ++ setup.py | 40 +++++++ tox.ini | 13 ++ 9 files changed, 201 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/test-publish.yaml create mode 100644 .gitignore create mode 100644 README.rst create mode 100644 devscripts/requirements/requirements_tests.txt create mode 100644 devscripts/requirements/requirements_tox.txt create mode 100644 setup.cfg create mode 100755 setup.py create mode 100644 tox.ini diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e4504cf --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git* export-ignore diff --git a/.github/workflows/test-publish.yaml b/.github/workflows/test-publish.yaml new file mode 100644 index 0000000..38b28f7 --- /dev/null +++ b/.github/workflows/test-publish.yaml @@ -0,0 +1,112 @@ +name: Run tests + +on: [push, pull_request] + +defaults: + run: + shell: bash -el {0} + +jobs: + run-tests: + env: + not_in_conda: "[]" + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "=3.9[build=*_pypy]"] + exclude: + - os: windows-latest + python-version: "2.7" + - os: macos-latest + python-version: "2.7" + - os: macos-latest + python-version: "3.5" + - os: macos-latest + python-version: "3.6" + - os: macos-latest + python-version: "3.7" + - os: macos-latest + python-version: "=3.9[build=*_pypy]" + - os: windows-latest + python-version: "=3.9[build=*_pypy]" + include: + - os: ubuntu-latest + os-name: Linux + pip-cache-path: ~/.cache/pip + - os: macos-latest + os-name: MacOS + pip-cache-path: ~/Library/Caches/pip + - os: windows-latest + os-name: w32 + pip-cache-path: ~\AppData\Local\pip\Cache + + name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }} + runs-on: ${{ matrix.os }} + + steps: + # Setup Python/pip + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + miniforge-version: latest + python-version: ${{ matrix.python-version }} + if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }} + # Python 3.7 is needed for ghactions-release script + - name: Install additional Python 3.7 + run: | + conda create -n py37 --yes python=3.7 + py37_prefix="`echo $CONDA_PREFIX | sed 's/__setup_conda/py37/'`" + ln -s "$py37_prefix/bin/python" "$CONDA_PREFIX/bin/python3.7" + ln -s "$py37_prefix/bin/pip" "$CONDA_PREFIX/bin/pip3.7" + python3.7 --version + pip3.7 --version + shell: bash + if: ${{ matrix.python-version == '2.7' && runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/') }} + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }} + - uses: actions/cache@v3 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda + - name: Cache pip + uses: actions/cache@v3 + with: + path: ${{ matrix.pip-cache-path }} + key: ${{ runner.os }}-pip + # Setup tox + - name: Install dependencies + run: | + python --version + python -m pip || python -m ensurepip --default-pip --upgrade + python -m pip install --upgrade pip setuptools wheel + pip --version + pip install --upgrade virtualenv "tox >= 3.15, < 4" + - name: Set TOXENV + run: | + python -c " + import os, sys + ld_library_path = None + if hasattr(sys, 'pypy_version_info'): + toxenv = 'pypy3' + else: + pyver = '%d%d' % tuple(sys.version_info[:2]) + if (pyver == '27') and (os.name == 'posix'): # Python 2.7 on Linux requires `$LD_LIBRARY_PATH` + ld_library_path = os.path.join( + os.path.dirname(os.path.dirname(sys.executable)), 'lib') + toxenv = 'py%s' % pyver + if os.name == 'posix': + toxenv += ',py%s-flake8' % pyver + with open(os.environ['GITHUB_ENV'], 'a') as f: + if ld_library_path: + f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n') + f.write('TOXENV=' + toxenv + '\n') + " + + - name: Run tox + run: | + python -c "import os; print(os.environ['TOXENV'])" + tox --version + tox diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fbec42f --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/.cache/ +/.tox/ +/build/ +/data/ +/dist/ +mc_tests_torrent_vfs.egg-info +/MANIFEST +*.py[co] +*.tmp +*~ diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..05d45aa --- /dev/null +++ b/README.rst @@ -0,0 +1,11 @@ +========================================== +Tests for torrent-vfs (Midnight Commander) +========================================== + +Author: Oleg Broytman . + +Copyright (C) 2025 PhiloSoft Design. + +License: GPL. + +| Git repo: https://git.phdru.name/mc/mc-tests-torrent-vfs.git/ diff --git a/devscripts/requirements/requirements_tests.txt b/devscripts/requirements/requirements_tests.txt new file mode 100644 index 0000000..21670e6 --- /dev/null +++ b/devscripts/requirements/requirements_tests.txt @@ -0,0 +1,2 @@ +pytest < 5.0; python_version == '2.7' or python_version == '3.4' +pytest < 7.0; python_version >= '3.5' diff --git a/devscripts/requirements/requirements_tox.txt b/devscripts/requirements/requirements_tox.txt new file mode 100644 index 0000000..8b5960b --- /dev/null +++ b/devscripts/requirements/requirements_tox.txt @@ -0,0 +1 @@ +tox >= 3.15 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..fc3066c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,11 @@ +[bdist_wheel] +universal = 1 + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + +[flake8] +exclude = .git,.tox + diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..8315122 --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +from setuptools import setup + +setup( + name='mc-tests-torrent-vfs', + version='0.0.1', + description='Tests for torrent-vfs (Midnight Commander)', + long_description=open('README.rst', 'r').read(), + long_description_content_type="text/x-rst", + author='Oleg Broytman', + author_email='phd@phdru.name', + project_urls={ + 'Git repo': 'https://git.phdru.name/mc/mc-tests-torrent-vfs.git/', + }, + license='GPL', + keywords=['mc', 'Midnight Commander', 'torrent', 'VFS', 'tests'], + platforms='Any', + classifiers=[ + 'Development Status :: 1 - Planning', + 'Environment :: Console', + 'Intended Audience :: End Users/Desktop', + 'License :: OSI Approved :: GNU General Public License (GPL)', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 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 :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + ], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', +) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..5309d84 --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +[tox] +minversion = 3.15 +envlist = py27,py3{4,5,6,7,8,9,10,11,12,13},pypy,pypy3 + +[testenv] +commands = + {envpython} --version + {envpython} -c "import struct; print(struct.calcsize('P') * 8)" + {envpython} -m pytest --version + {envpython} -m pytest +passenv = CI DISTUTILS_USE_SDK MSSdk INCLUDE LIB WINDIR +deps = + -rdevscripts/requirements/requirements_tests.txt -- 2.39.5