Merge pull request #178 from pyfisch/packaging

Simplify packaging
This commit is contained in:
Anton Hvornum 2021-04-05 18:10:28 +00:00 committed by GitHub
commit 1240cbdaf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 83 additions and 196 deletions

View File

@ -2,8 +2,7 @@
# Contributor: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgbase=archinstall-git
pkgname=('archinstall-git' 'python-archinstall-git')
pkgname=archinstall-git
pkgver=$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
pkgrel=1
pkgdesc="Just another guided/automated Arch Linux installer with a twist"
@ -12,33 +11,14 @@ url="https://github.com/archlinux/archinstall"
license=('GPL')
depends=('python')
makedepends=('python-setuptools')
conflicts=('archinstall' 'archinstall-python' 'python-archinstall-git')
build() {
cd "$startdir"
cd "$startdir"
python setup.py build
}
package_archinstall-git() {
depends=('python-archinstall-git')
conflicts=('archinstall')
cd "$startdir"
mkdir -p "${pkgdir}/usr/bin"
# Install a guided profile
cat - > "${pkgdir}/usr/bin/archinstall" <<EOF
#!/bin/sh
python -m archinstall $@
EOF
chmod +x "${pkgdir}/usr/bin/archinstall"
}
package_python-archinstall-git() {
conflicts=('python-archinstall')
cd "$startdir"
python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
package() {
cd "$startdir"
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

View File

@ -1,39 +0,0 @@
# Maintainer: Anton Hvornum anton@hvornum.se
# Contributor: Anton Hvornum anton@hvornum.se
pkgname="archinstall-bin"
pkgver="2.1.3"
pkgdesc="Installs a pre-built binary of ${pkgname}"
pkgrel=1
url="https://github.com/archlinux/archinstall"
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz")
#depends=('python>=3.8')
makedepends=('python>=3.8' 'nuitka')
optdepends=('pyttsx3: Adds text-to-speach support for log/screen output.')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
build() {
cd "${pkgname}-${pkgver}"
nuitka3 --standalone --show-progress archinstall
cp -r examples/ archinstall.dist/
}
package() {
echo "${srcdir}"
cd "${pkgname}-${pkgver}"
mkdir -p "${pkgdir}/var/lib/archinstall/"
mkdir -p "${pkgdir}/usr/bin"
mv archinstall.dist/* "${pkgdir}/var/lib/archinstall/"
echo '#!/bin/bash' > "${pkgdir}/usr/bin/archinstall-bin"
echo '(cd /var/lib/archinstall && exec ./archinstall)' >> "${pkgdir}/usr/bin/archinstall-bin"
chmod +x "${pkgdir}/var/lib/archinstall/archinstall"
chmod +x "${pkgdir}/usr/bin/archinstall-bin"
}

View File

@ -1,30 +0,0 @@
# Maintainer: Anton Hvornum <anton@hvornum.se>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgname="archinstall"
pkgver="2.1.3"
pkgdesc="Installs launcher scripts for archinstall"
pkgrel=1
url="https://github.com/archlinux/archinstall"
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz")
depends=('python-archinstall')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
package() {
mkdir -p "${pkgdir}/usr/bin"
# Install a guided profile
cat - > "${pkgdir}/usr/bin/archinstall" <<EOF
#!/bin/sh
python -m archinstall $@
EOF
chmod +x "${pkgdir}/usr/bin/archinstall"
}
# vim:ft=sh

View File

@ -1,40 +0,0 @@
# Maintainer: Anton Hvornum <anton@hvornum.se>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgname="python-archinstall"
pkgver="2.1.3"
pkgdesc="Installs ${pkgname} as a python library."
pkgrel=1
url="https://github.com/archlinux/archinstall"
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz")
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
depends=('python>=3.8')
makedepends=('python-setuptools')
optdepends=('pyttsx3: Adds text-to-speech support for log/screen output.')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
build() {
cd "archinstall-${pkgver}"
python setup.py build
# Build man pages
cd docs
make man
}
package() {
cd "archinstall-${pkgver}"
python setup.py install \
--prefix=/usr \
--root="${pkgdir}" \
--optimize=1
install -Dm644 docs/_build/man/archinstall.1 "${pkgdir}"/usr/share/man/man1/archinstall.1
}
# vim:ft=sh

View File

@ -1 +0,0 @@
2.1.3

View File

@ -1,3 +0,0 @@
# This __init__ file is just here to support the
# use of archinstall as a git submodule.
from .archinstall import *

View File

@ -14,6 +14,8 @@ from .lib.output import *
from .lib.storage import *
from .lib.hardware import *
__version__ = "2.1.3"
## Basic version of arg.parse() supporting:
## --key=value
## --boolean
@ -27,4 +29,33 @@ for arg in sys.argv[1:]:
key, val = arg[2:], True
arguments[key] = val
else:
positionals.append(arg)
positionals.append(arg)
# TODO: Learn the dark arts of argparse...
# (I summon thee dark spawn of cPython)
def run_as_a_module():
"""
Since we're running this as a 'python -m archinstall' module OR
a nuitka3 compiled version of the project.
This function and the file __main__ acts as a entry point.
"""
# Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc.
storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
if len(sys.argv) == 1:
sys.argv.append('guided')
try:
script = Script(sys.argv[1])
except ProfileNotFound as err:
print(f"Couldn't find file: {err}")
sys.exit(1)
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions.
storage['PROFILE_PATH'].pop()
script.execute()

View File

@ -2,33 +2,5 @@ import archinstall
import sys
import os
# TODO: Learn the dark arts of argparse...
# (I summon thee dark spawn of cPython)
def run_as_a_module():
"""
Since we're running this as a 'python -m archinstall' module OR
a nuitka3 compiled version of the project.
This function and the file __main__ acts as a entry point.
"""
# Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc.
archinstall.storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
if len(sys.argv) == 1:
sys.argv.append('guided')
try:
script = archinstall.Script(sys.argv[1])
except archinstall.ProfileNotFound as err:
print(f"Couldn't find file: {err}")
sys.exit(1)
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions.
archinstall.storage['PROFILE_PATH'].pop()
script.execute()
if __name__ == '__main__':
run_as_a_module()
archinstall.run_as_a_module()

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

39
setup.cfg Normal file
View File

@ -0,0 +1,39 @@
[metadata]
name = archinstall
version = attr: archinstall.__version__
description = Arch Linux installer - guided, templates etc.
author = Anton Hvornum
author_email = anton@hvornum.se
long_description = file: README.md
long_description_content_type = text/markdown
license = GPL
license_files =
LICENSE
project_urls =
Source = https://github.com/archlinux/archinstall
Documentation = https://archinstall.readthedocs.io/
classifers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: POSIX :: Linux
[options]
packages = find:
python_requires = >= 3.8
[options.packages.find]
include =
archinstall
archinstall.*
[options.package_data]
archinstall =
examples/*.py
profiles/*.py
profiles/applications/*.py
[options.entry_points]
console_scripts =
archinstall = archinstall:run_as_a_module

View File

@ -1,27 +1,2 @@
import setuptools, glob, shutil
with open("README.md", "r") as fh:
long_description = fh.read()
with open('VERSION', 'r') as fh:
VERSION = fh.read()
setuptools.setup(
name="archinstall",
version=VERSION,
author="Anton Hvornum",
author_email="anton@hvornum.se",
description="Arch Linux installer - guided, templates etc.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/archlinux/archinstall",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux",
],
python_requires='>=3.8',
setup_requires=['wheel'],
package_data={'archinstall': glob.glob('examples/*.py') + glob.glob('profiles/*.py') + glob.glob('profiles/applications/*.py')},
)
import setuptools
setuptools.setup()