Skip to content

Commit 95e64f2

Browse files
author
rocky
committed
Packaging
1 parent 99bdc91 commit 95e64f2

File tree

4 files changed

+95
-44
lines changed

4 files changed

+95
-44
lines changed

README.rst

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ xasm
55

66
*NOTE: this is in beta*
77

8-
A Cross-Python bytecode Assembler
8+
A cross-version Python bytecode assembler
99

1010

1111
Introduction
1212
------------
1313

14-
The Python `xasm` module has routines for assembly, and has a command to
14+
The Python ``xasm`` module has routines for assembly, and has a command to
1515
assemble bytecode for several different versions of Python.
1616

1717
Here are some potential uses:
@@ -23,10 +23,10 @@ Here are some potential uses:
2323
* Foil decompilers like uncompyle6_ so that they can’t disassemble bytecode (at least for now)
2424

2525
This support the same kinds of bytecode that xdis_ supports. This is
26-
pretty much all released bytecode, although we tend to lag behind the
26+
pretty much all released bytecode before Python 3.11. We tend to lag behind the
2727
latest Python releases.
2828

29-
The code requires Python 2.7 or later.
29+
The code requires Python 3.6 or later.
3030

3131
Assembly files
3232
--------------
@@ -47,17 +47,30 @@ See how-to-use_ for more detail. Some general some principles:
4747
Installation
4848
------------
4949

50-
The standard Python routine:
50+
*If you are using Python 3.11 or later*, you can install from PyPI using the name ``xasm``::
5151

52-
::
53-
54-
pip install -e .
55-
pip install -r requirements-dev.txt
52+
pip install xasm
5653

57-
A GNU makefile is also provided so :code:`make install` (possibly as root or
54+
A GNU makefile is also provided so ``make install`` (possibly as root or
5855
sudo) will do the steps above.
5956

6057

58+
*If you are using Python before 3.11*, do not install using PyPI, but instead install using a file in the [GitHub Releases section](https://github.com/rocky/python-xasm/releases). Older Python used to use `easy_install <https://python101.pythonlibrary.org/chapter29_pip.html#using-easy-install>`_. But this is no longer supported in PyPi or newer Python versions. And vice versa, *poetry* nor *pip*, (the newer ways) are not supported on older Pythons.
59+
60+
If the Python version you are running xasm is between Python 3.6 through 3.11, use a tarball called xasm_36-*x.y.z*.tar.gz.
61+
62+
If the Python version you are running xasm is 3.11 or later, use a file called xasm-*x.y.z*.tar.gz.
63+
64+
Similarly, a tarball with or without the underscore *xx*, e.g., xasm_36-*x.y.z*.tar.gz. works only from Python 3.11 or greater.
65+
66+
Rationale for using Git Branches
67+
++++++++++++++++++++++++++++++++
68+
69+
It is currently impossible (if not impractical) to have one Python source code of this complexity and with this many features that can run both Python 3.6 and Python 3.13+. The languages have drifted so much, and packaging is vastly different.
70+
71+
A GNU makefile is also provided so :code:`make install` (possibly as root or sudo) will do the steps above.
72+
73+
6174
Testing
6275
-------
6376

@@ -137,8 +150,8 @@ Here is an assembly for the above:
137150
RETURN_VALUE
138151

139152

140-
The above can be created automatically from Python source code using the `pydisasm`
141-
command from `xdis`:
153+
The above can be created automatically from Python source code using the ``pydisasm``
154+
command from ``xdis``:
142155

143156
::
144157

admin-tools/make-dist-newest.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/bin/bash
22
# The name Python's import uses.
33
# It is reflected in the directory structure.
4-
PACKAGE_MODULE="python_control_flow"
4+
PACKAGE_MODULE="xasm"
55

66
# The name that PyPi sees this as.
77
# It is set in setup.py's name.
8-
PACKAGE_NAME="python-control-flow"
8+
PACKAGE_NAME="xasm"
99

1010
# FIXME put some of the below in a common routine
1111
function finish {
12-
if [[ -n "$make_dist_python_control_flow_owd" ]] then
13-
cd $make_dist_python_control_flow_newest_owd
12+
if [[ -n "$make_dist_xasm_owd" ]] then
13+
cd $make_dist_xasm_newest_owd
1414
fi
1515
}
1616

17-
make_dist_python_control_flow_newest_owd=$(pwd)
17+
make_dist_xasm_newest_owd=$(pwd)
1818
cd $(dirname ${BASH_SOURCE[0]})
1919
trap finish EXIT
2020

pyproject.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
]
5+
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
authors = [
10+
{name = "Rocky Bernstein", email = "rb@dustyfeet.com"},
11+
]
12+
13+
name = "xasm"
14+
description = "Cross-version Python bytecode assembler"
15+
dependencies = [
16+
"click",
17+
"xdis >= 6.1.1, < 6.3.0",
18+
]
19+
readme = "README.rst"
20+
license = "GPL-2.0"
21+
keywords = ["Python bytecode", "bytecode", "disassembler"]
22+
classifiers = [
23+
"Development Status :: 4 - Beta",
24+
"Intended Audience :: Developers",
25+
"Programming Language :: Python",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
33+
"Topic :: Software Development :: Code Generators",
34+
]
35+
dynamic = ["version"]
36+
37+
[project.urls]
38+
Homepage = "https://github.com/rocky/python-xasm"
39+
Downloads = "https://github.com/rocky/python-xasm/releases"
40+
41+
[project.optional-dependencies]
42+
dev = [
43+
"pre-commit",
44+
"black",
45+
"isort",
46+
"pytest",
47+
]
48+
49+
[project.scripts]
50+
python-cfg = "xasm.__main__:main"
51+
52+
[tool.setuptools]
53+
packages = [
54+
"xasm",
55+
]
56+
57+
[tool.setuptools.dynamic]
58+
version = {attr = "xasm.version.__version__"}
59+
60+
[tool.pyright]
61+
include = ["xasm"]
62+
# exclude = []
63+
ignore = ["dist", "docs", "tmp", ".cache"]

setup.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,6 @@
22

33
"""Setup script for the 'xasm' distribution."""
44

5-
from setuptools import find_packages, setup
5+
from setuptools import setup
66

7-
from __pkginfo__ import (__version__, author, author_email, classifiers,
8-
install_requires, license, long_description, modname,
9-
py_modules, short_desc, tests_require, web, zip_safe)
10-
11-
setup(
12-
author=author,
13-
author_email=author_email,
14-
classifiers=classifiers,
15-
description=short_desc,
16-
license=license,
17-
long_description=long_description,
18-
long_description_content_type="text/x-rst",
19-
name=modname,
20-
packages=find_packages(),
21-
py_modules=py_modules,
22-
install_requires=install_requires,
23-
entry_points="""
24-
[console_scripts]
25-
pyc-xasm = xasm.xasm_cli:main
26-
pyc-convert = xasm.pyc_convert:main
27-
""",
28-
tests_require=tests_require,
29-
url=web,
30-
version=__version__,
31-
zip_safe=zip_safe,
32-
)
7+
setup()

0 commit comments

Comments
 (0)