Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyproject.toml and move metadata from setup.py #267

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ jobs:

- name: Build and install
run: |
python setup.py bdist_wheel
python -m build
pip install dist/staticx-*-py3-none-manylinux1_x86_64.whl
staticx --version

# Make sure we only use the installed wheel
rm -r staticx bootloader

- name: Run unit tests
run: |
pytest -v
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel

sudo apt-get update
sudo apt-get install -y musl-tools scons
Expand All @@ -50,7 +49,7 @@ jobs:
export CI_VERSION_BUILD_NUMBER=${{ github.run_id }}
fi

python setup.py sdist bdist_wheel
python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
3 changes: 2 additions & 1 deletion VERSIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ versioning scheme. Consider a base version of `1.2.3`:
created via `python setup.py sdist`. In this case, the version comes from
the egg info generated by setuptools.

In any case, when StaticX is installed, the version comes from `pkg_resources`.
In any case, when StaticX is installed, the version comes from
`importlib.metadata`.
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[project]
name = "staticx"
dynamic = ["version"]

authors = [
{name = "Jonathon Reinhart", email="[email protected]"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"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 :: Implementation :: CPython",
"Topic :: Software Development :: Build Tools",
]
dependencies = [
"pyelftools",
]
description = "Build static self-extracting app from dynamic executable"
license = {file = "LICENSE.txt"}
readme = "README.md"
requires-python = ">=3.7"

[project.scripts]
staticx = "staticx.__main__:main"
sx-extract = "staticx.extract:main"

[project.urls]
documentation = "https://staticx.readthedocs.io/"
repository = "https://github.com/JonathonReinhart/staticx"
changelog = "https://github.com/JonathonReinhart/staticx/blob/main/CHANGELOG.md"

[build-system]
# Tells pip to install wheel before trying to install
# from an sdist or from Github.
requires = [
"wheel",
"setuptools >= 42.0.0",
]
7 changes: 1 addition & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# These requirements are in addition to install_requires from setup.py
# and are only used for development and testing.
build
patchelf-wrapper
pyinstaller

# https://github.com/pypa/setuptools/issues/1963
# Exclude from 45.0.0 until 49.1.1
setuptools !=45.*, !=46.*, !=47.*, !=48.*, !=49.1.0

scuba
wheel
cffi # Used for test/pyinstall-cffi/
pytest
-r docs/requirements.txt
60 changes: 10 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,62 +113,22 @@ def get_platform():

################################################################################

def read_project_file(path):
proj_dir = os.path.dirname(__file__)
path = os.path.join(proj_dir, path)
with open(path, 'r') as f:
return f.read()

setup(
name = 'staticx',
#####
# Dynamic core metadata, in addition to pyproject.toml [project]
version = get_dynamic_version(),
description = 'Build static self-extracting app from dynamic executable',
python_requires='>=3.7',
long_description = read_project_file('README.md'),
long_description_content_type = 'text/markdown',
classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'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 :: Implementation :: CPython',
'Topic :: Software Development :: Build Tools',
],
license = 'GPL v2 with special exception allowing StaticX to build and'
' distribute non-free programs',
author = 'Jonathon Reinhart',
author_email = '[email protected]',
url = 'https://github.com/JonathonReinhart/staticx',
packages = find_packages(),
#####
# Setuptools-specific config
# We could put this in pyproject.toml [tool.setuptools], but choose not to:
# - The functionality is still in beta and requires setuptools >= 61.0.0
# - We need setup.py to provide build_hook, so we might as well keep all
# setuptools-specific config here, in one file.
packages=find_packages(),
package_data = {
'staticx': ['assets/*/*'],
},

# Ugh.
# https://github.com/JonathonReinhart/staticx/issues/22
# https://github.com/JonathonReinhart/scuba/issues/77
# https://github.com/pypa/setuptools/issues/1064
include_package_data = True,

include_package_data=True, # https://github.com/pypa/setuptools/issues/1064
zip_safe = False, # http://stackoverflow.com/q/24642788/119527
entry_points = {
'console_scripts': [
'staticx = staticx.__main__:main',
'sx-extract = staticx.extract:main',
]
},
install_requires = [
'pyelftools',
],

# http://stackoverflow.com/questions/17806485
# http://stackoverflow.com/questions/21915469
# PyInstaller setup.py
Expand Down