From 7f691ce1c992c16551459162fbef593daad1e4c8 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 15:30:18 +0200 Subject: Switch to setup.cfg Configure setup.cfg to find all Python packages. Add more metadata to package. --- archinstall/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archinstall/__init__.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index d4452d38..c2773b64 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -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,4 @@ for arg in sys.argv[1:]: key, val = arg[2:], True arguments[key] = val else: - positionals.append(arg) \ No newline at end of file + positionals.append(arg) -- cgit v1.2.3-70-g09d2 From ecf7a2a237a04882c93fd4d743b037f7af6bc253 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 16:21:12 +0200 Subject: Add console_scripts archinstall entry point archinstall should be callable from the command-line. Previously this was achieved with a shell script, however Python packages contain a built in way to to this via the entry points mechanism. --- archinstall/__init__.py | 29 +++++++++++++++++++++++++++++ archinstall/__main__.py | 30 +----------------------------- setup.cfg | 4 ++++ 3 files changed, 34 insertions(+), 29 deletions(-) (limited to 'archinstall/__init__.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index c2773b64..d98b6daa 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -30,3 +30,32 @@ for arg in sys.argv[1:]: arguments[key] = val else: 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() diff --git a/archinstall/__main__.py b/archinstall/__main__.py index 63c2f715..86ed0108 100644 --- a/archinstall/__main__.py +++ b/archinstall/__main__.py @@ -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() diff --git a/setup.cfg b/setup.cfg index ccbddf8a..3190791e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,3 +33,7 @@ archinstall = examples/*.py profiles/*.py profiles/applications/*.py + +[options.entry_points] +console_scripts = + archinstall = archinstall:run_as_a_module -- cgit v1.2.3-70-g09d2 From 413565dbd0f4d5f5080f96c1d1ecd0c596e1d95b Mon Sep 17 00:00:00 2001 From: advaithm Date: Mon, 12 Apr 2021 19:39:23 +0530 Subject: moved to flit build system --- .github/workflows/python-publish.yml | 9 ++++----- .pypirc | 6 ++++++ archinstall/__init__.py | 1 + pyproject.toml | 31 +++++++++++++++++++++++++++++-- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 .pypirc (limited to 'archinstall/__init__.py') diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 09bcba55..c24fc0d7 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,11 +21,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools wheel flit - name: Build and publish env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }} + FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + flit publish diff --git a/.pypirc b/.pypirc new file mode 100644 index 00000000..7b926de7 --- /dev/null +++ b/.pypirc @@ -0,0 +1,6 @@ +[distutils] +index-servers = + pypi + +[pypi] +repository = https://upload.pypi.org/legacy/ \ No newline at end of file diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 8a49bef6..0a6e63fd 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -1,3 +1,4 @@ +"""Arch Linux installer - guided, templates etc.""" from .lib.general import * from .lib.disk import * from .lib.user_interaction import * diff --git a/pyproject.toml b/pyproject.toml index 9787c3bd..330216df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,30 @@ [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["flit_core >=2,<4"] +build-backend = "flit_core.buildapi" + +[tool.flit.metadata] +module = "archinstall" +author = "Anton Hvornum" +author-email = "anton@hvornum.se" +home-page = "https://archlinux.org" +classifiers = [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", +"Programming Language :: Python :: 3.8", +"Programming Language :: Python :: 3.9", +"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", +"Operating System :: POSIX :: Linux", +] +description-file = "README.md" +requires-python=">=3.8" +[tool.flit.metadata.urls] +Source = "https://github.com/archlinux/archinstall" +Documentation = "https://archinstall.readthedocs.io/" + +[tool.flit.scripts] +archinstall = "archinstall:run_as_a_module" + +[tool.flit.sdist] +include = ["doc/"] +exclude = ["doc/*.html"] + +[tool.flit.metadata.requires-extra] +doc = ["sphinx"] \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 7f3e12b50f8818bc07beeab9371f7b039916dca3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 15 Apr 2021 10:03:04 -0400 Subject: Change version to 2.2.0 in 2.2.0 branch --- archinstall/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/__init__.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 0a6e63fd..bc58af54 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -15,7 +15,7 @@ from .lib.output import * from .lib.storage import * from .lib.hardware import * -__version__ = "2.1.3" +__version__ = "2.2.0" ## Basic version of arg.parse() supporting: ## --key=value -- cgit v1.2.3-70-g09d2