pmbootstrap-meow/setup.py
Oliver Smith d51f31e784
setup.py: adjust path to pmb.__version__
setup.py is on its way out, but it isn't replaced just yet. Adjust the
code that finds the version.

I'm pushing this directly to master as this fix is trivial and unbreaks
packaging current master of pmbootstrap.

Fix for (from pmbootstrap AUR package):
$ pip install build wheel
$ python -m build --wheel --no-isolation
  File "/usr/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    {"edge": "2.12.11-r0",
    ^
SyntaxError: '{' was never closed

Fixes: 6352ab9c ("Move version to pmb.__version__")
Fixes: pmbootstrap#2226
2023-04-17 08:11:51 +02:00

75 lines
2.2 KiB
Python
Executable file

#!/usr/bin/env python3
import re
import ast
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from codecs import open
from os import path
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', 'Arguments to pass to pytest')]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ''
def run_tests(self):
import shlex
import pytest
errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)
here = path.abspath(path.dirname(__file__))
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open(path.join(here, 'pmb/__init__.py'), 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pmbootstrap',
version=version,
description='A sophisticated chroot / build / flash tool to '
'develop and install postmarketOS',
long_description=long_description,
long_description_content_type='text/markdown',
author='postmarketOS Developers',
author_email='info@postmarketos.org',
url='https://www.postmarketos.org',
license='GPLv3',
python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'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',
],
keywords='postmarketos pmbootstrap',
packages=find_packages(exclude=['aports', 'keys', 'test']),
tests_require=['pytest'],
cmdclass={'test': PyTest},
extras_require={
'completion': ['argcomplete'],
},
entry_points={
'console_scripts': [
'pmbootstrap=pmb:main',
],
},
include_package_data=True,
)