diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 692857e..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: xasm (macos) - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: macos-latest - strategy: - matrix: - os: [macOS] - python-version: ['3.11', '3.12', '3.13'] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # We can comment out after next xdis release - python -m pip install -e git+https://github.com/rocky/python-xdis#egg=xdis - pip install -e . - pip install -r requirements-dev.txt - - name: Test xasm - run: | - make check diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml deleted file mode 100644 index 4b4c5bf..0000000 --- a/.github/workflows/ubuntu.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: xdis (ubuntu) - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.11', '3.12', '3.13'] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # We can comment out after next xdis release - python -m pip install -e git+https://github.com/rocky/python-xdis#egg=xdis - pip install -e . - pip install -r requirements-dev.txt - - name: Test xasm - run: | - make check diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 2d73cb6..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: xasm (windows) - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: windows-latest - strategy: - matrix: - os: [windows] - python-version: ['3.11', '3.12', '3.13'] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # We can comment out after next xdis release - python -m pip install -e git+https://github.com/rocky/python-xdis#egg=xdis - pip install -e . - pip install -r requirements-dev.txt - - name: Test xasm - run: | - # Until workflows CI problems are fixed - make check diff --git a/__pkginfo__.py b/__pkginfo__.py new file mode 100644 index 0000000..2d11a81 --- /dev/null +++ b/__pkginfo__.py @@ -0,0 +1,72 @@ +"""xasm packaging information""" + +# To the extent possible we make this file look more like a +# configuration file rather than code like setup.py. I find putting +# configuration stuff in the middle of a function call in setup.py, +# which for example requires commas in between parameters, is a little +# less elegant than having it here with reduced code, albeit there +# still is some room for improvement. + +import os.path as osp + +# Things that change more often go here. +copyright = """ +Copyright (C) 2017, 2019-2021, 2024-2025 Rocky Bernstein . +""" + +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "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", + "Topic :: Software Development :: Debuggers", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +# The rest in alphabetic order +author = "Rocky Bernstein" +author_email = "rb@dustyfeet.com" +ftp_url = None +install_requires = ["xdis >= 6.1.0"] +license = "GPL-2.0" +mailing_list = "python-debugger@googlegroups.com" +modname = "xasm" +py_modules = [] +setup_requires = ["pytest-runner", "xdis >= 6.1.0"] +# scripts = ['bin/pydisasm'] +short_desc = "Python cross-version byte-code assembler" +tests_require = ["pytest"] +web = "https://github.com/rocky/python-xasm/" + +# tracebacks in zip files are funky and not debuggable +zip_safe = True + + +def get_srcdir() -> str: + filename = osp.normcase(osp.dirname(osp.abspath(__file__))) + return osp.realpath(filename) + + +srcdir = get_srcdir() + + +def read(*rnames) -> str: + return open(osp.join(srcdir, *rnames)).read() + + +# Get info from files; set: long_description and VERSION +long_description = read("README.rst") + "\n" + +# The below exec() overwrites __version +__version__ = "??" +exec(read("xasm/version.py")) diff --git a/admin-tools/check-3.6-3.10-versions.sh b/admin-tools/check-3.6-3.10-versions.sh index 5be48b6..e111a09 100755 --- a/admin-tools/check-3.6-3.10-versions.sh +++ b/admin-tools/check-3.6-3.10-versions.sh @@ -10,7 +10,7 @@ xasm_owd=$(pwd) # trap finish EXIT cd $(dirname ${BASH_SOURCE[0]}) -if ! source ./pyenv-3.8-3.10-versions ; then +if ! source ./pyenv-3.6-3.10-versions ; then exit $? fi diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 92f3636..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,63 +0,0 @@ -[build-system] -requires = [ - "setuptools", -] - -build-backend = "setuptools.build_meta" - -[project] -authors = [ - {name = "Rocky Bernstein", email = "rb@dustyfeet.com"}, -] - -name = "xasm" -description = "Cross-version Python bytecode assembler" -dependencies = [ - "click", - "xdis > 6.3.0", -] -readme = "README.rst" -license = "GPL-2.0" -keywords = ["Python bytecode", "bytecode", "disassembler"] -classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Programming Language :: Python", - "Topic :: Software Development :: Libraries :: Python Modules", - "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", - "Topic :: Software Development :: Code Generators", -] -dynamic = ["version"] - -[project.urls] -Homepage = "https://github.com/rocky/python-xasm" -Downloads = "https://github.com/rocky/python-xasm/releases" - -[project.optional-dependencies] -dev = [ - "pre-commit", - "black", - "isort", - "pytest", -] - -[project.scripts] -pyc-xasm = "xasm.xasm_cli:main" - -[tool.setuptools] -packages = [ - "xasm", -] - -[tool.setuptools.dynamic] -version = {attr = "xasm.version.__version__"} - -[tool.pyright] -include = ["xasm"] -# exclude = [] -ignore = ["dist", "docs", "tmp", ".cache"] diff --git a/pytest/test_write_pyc.py b/pytest/test_write_pyc.py index a17be7a..ed925ec 100644 --- a/pytest/test_write_pyc.py +++ b/pytest/test_write_pyc.py @@ -44,7 +44,7 @@ def test_roundtrip3() -> None: print("Wrote Python %s bytecode file %s; %d bytes" % (version_tuple, fp.name, size)) old_fp = open(orig_path, "rb") new_fp = open(new_path, "rb") - if PYTHON_VERSION_TRIPLE < (3, 7): + if PYTHON_VERSION_TRIPLE < (3, 6): compare_size = 590 assert old_fp.read(compare_size) == new_fp.read(compare_size) else: diff --git a/setup.py b/setup.py index d74d4cc..97b6964 100755 --- a/setup.py +++ b/setup.py @@ -2,6 +2,43 @@ """Setup script for the 'xasm' distribution.""" -from setuptools import setup +from setuptools import find_packages, setup -setup() +from __pkginfo__ import ( + __version__, + author, + author_email, + classifiers, + install_requires, + license, + long_description, + modname, + py_modules, + short_desc, + tests_require, + web, + zip_safe, +) + +setup( + author=author, + author_email=author_email, + classifiers=classifiers, + description=short_desc, + license=license, + long_description=long_description, + long_description_content_type="text/x-rst", + name=modname, + packages=find_packages(), + py_modules=py_modules, + install_requires=install_requires, + entry_points=""" + [console_scripts] + pyc-xasm = xasm.xasm_cli:main + pyc-convert = xasm.pyc_convert:main + """, + tests_require=tests_require, + url=web, + version=__version__, + zip_safe=zip_safe, +) diff --git a/xasm/assemble.py b/xasm/assemble.py index eca4a48..58761f3 100644 --- a/xasm/assemble.py +++ b/xasm/assemble.py @@ -37,7 +37,7 @@ def is_int(s: Any) -> bool: return False -def match_lineno(s: str) -> Optional[re.Match]: +def match_lineno(s: str): return re.match(r"^\d+:", s)