More formatting fixes

This commit is contained in:
Dylan Taylor 2021-05-15 12:59:38 -04:00
parent e966bef891
commit 6057203e5b
11 changed files with 121 additions and 97 deletions

View File

@ -1,47 +1,69 @@
# Contributing to archinstall
Any contributions through pull requests are welcome as this project aims to be a community based project to ease some Arch Linux installation steps. Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general public)*.
Any contributions through pull requests are welcome as this project aims to be a community based project to ease some
Arch Linux installation steps. Bear in mind that in the future this repo might be transferred to the
official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general
public)*.
Therefore guidelines and style changes to the code might come into affect as well as guidelines surrounding bug reporting and discussions.
Therefore guidelines and style changes to the code might come into affect as well as guidelines surrounding bug
reporting and discussions.
## Branches
`master` is currently the default branch, and that's where all future feature work is being done, this means that `master` is a living entity and will most likely never be in a fully stable state. For stable releases, please see the tagged commits.
`master` is currently the default branch, and that's where all future feature work is being done, this means
that `master` is a living entity and will most likely never be in a fully stable state. For stable releases, please see
the tagged commits.
Patch releases will be done against their own branches, branched from stable tagged releases and will be named according to the version it will become on release *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*.
Patch releases will be done against their own branches, branched from stable tagged releases and will be named according
to the version it will become on release *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*.
## Discussions
Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).<br>
Currently, questions, bugs and suggestions should be reported
through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).<br>
For less formal discussions there are also a [archinstall Discord server](https://discord.gg/cqXU88y).
## Coding convention
Archinstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor exceptions.<br>
Archinstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor
exceptions.<br>
The exceptions to PEP8 are:
* Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it easier for non-IDE developers to navigate the code *(Tab display-width should be equal to 4 spaces)*. Exception to the rule are comments that need fine-tuned indentation for documentation purposes.
* [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) should aim for no more than 100 characters, but not strictly enforced.
* [Line breaks before/after binary operator](https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator) is not enforced, as long as the style of line breaks are consistent within the same code block.
* Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it
easier for non-IDE developers to navigate the code *(Tab display-width should be equal to 4 spaces)*. Exception to the
rule are comments that need fine-tuned indentation for documentation purposes.
* [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) should aim for no more than 100
characters, but not strictly enforced.
* [Line breaks before/after binary operator](https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator)
is not enforced, as long as the style of line breaks are consistent within the same code block.
* Archinstall should always be saved with **Unix-formatted line endings** and no other platform-specific formats.
* [Blank lines](https://www.python.org/dev/peps/pep-0008/#blank-lines) before/after imports and functions are not followed and discouraged. One space is commonly used in archinstall.
* Multiple [Imports](https://www.python.org/dev/peps/pep-0008/#imports) on the same line is allowed, but more than five imports should be avoided on any given line. This simply saves up some space at the top of the file *(for non-IDE developers)* and will not be enforced.
* [String quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes) follow PEP8, the exception being when creating formatted strings, double-quoted strings are *preferred* but not required on the outer edges *(Example: `f"Welcome {name}"` rather than `f'Welcome {name}'`)*.
* [Blank lines](https://www.python.org/dev/peps/pep-0008/#blank-lines) before/after imports and functions are not
followed and discouraged. One space is commonly used in archinstall.
* Multiple [Imports](https://www.python.org/dev/peps/pep-0008/#imports) on the same line is allowed, but more than five
imports should be avoided on any given line. This simply saves up some space at the top of the file *(for non-IDE
developers)* and will not be enforced.
* [String quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes) follow PEP8, the exception being when
creating formatted strings, double-quoted strings are *preferred* but not required on the outer edges *(
Example: `f"Welcome {name}"` rather than `f'Welcome {name}'`)*.
Most of these style guidelines have been put into place after the fact *(in an attempt to clean up the code)*.<br>
There might therefore be older code which does not follow the coding convention and the code is subject to change.
## Submitting Changes
Archinstall uses Github's pull-request workflow and all contributions in terms of code should be done through pull requests.<br>
Archinstall uses Github's pull-request workflow and all contributions in terms of code should be done through pull
requests.<br>
Anyone interested in archinstall may review your code. One of the core developers will merge your pull request when they think it is ready.
For every pull request, we aim to promptly either merge it or say why it is not yet ready; if you go a few days without a reply, please feel free to ping the thread by adding a new comment.
Anyone interested in archinstall may review your code. One of the core developers will merge your pull request when they
think it is ready. For every pull request, we aim to promptly either merge it or say why it is not yet ready; if you go
a few days without a reply, please feel free to ping the thread by adding a new comment.
To get your pull request merged sooner, you should explain why you are making the change. For example, you can point to a code sample that is outdated in terms of Arch Linux command lines.
It is also helpful to add links to online documentation or to the implementation of the code you are changing.
To get your pull request merged sooner, you should explain why you are making the change. For example, you can point to
a code sample that is outdated in terms of Arch Linux command lines. It is also helpful to add links to online
documentation or to the implementation of the code you are changing.
Also, do not squash your commits after you have submitted a pull request, as this erases context during review. We will squash commits when the pull request is merged.
Also, do not squash your commits after you have submitted a pull request, as this erases context during review. We will
squash commits when the pull request is merged.
At present the current contributors are (alphabetically):

View File

@ -86,7 +86,6 @@ def list_mirrors():
log(f'Could not fetch an active mirror-list: {err}', level=logging.WARNING, fg="yellow")
return regions
region = 'Unknown region'
for line in response.readlines():
if len(line.strip()) == 0:

View File

@ -1,8 +1,9 @@
import os
import fcntl
import os
import socket
import struct
from collections import OrderedDict
from .exceptions import *
from .general import sys_command
from .storage import storage

View File

@ -1,8 +1,9 @@
import abc
import logging
import os
import sys
import logging
from pathlib import Path
from .storage import storage

View File

@ -7,6 +7,7 @@ import sys
import urllib.parse
import urllib.request
from typing import Optional
from .general import multisplit
from .networking import *
from .storage import storage

View File

@ -48,6 +48,7 @@ def check_for_correct_username(username):
def do_countdown():
SIG_TRIGGER = False
def kill_handler(sig, frame):
print()
exit(0)
@ -674,7 +675,8 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
print_large_list(regions, margin_bottom=4)
print(' -- You can skip this step by leaving the option blank --')
selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ',
selected_mirror = generic_select(regions,
'Select one of the above regions to download packages from (by number or full name): ',
options_output=False)
if not selected_mirror:
# Returning back empty options which can be both used to

View File

@ -43,7 +43,6 @@ author = 'Anton Hvornum'
# The full version, including alpha/beta/rc tags
release = 'v2.1.0'
# -- General configuration ---------------------------------------------------
master_doc = 'index'
@ -64,7 +63,6 @@ templates_path = ['_templates']
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for

View File

@ -12,5 +12,5 @@ If the PR is larger than ~20 lines, please describe it here unless described in
# Testing
Any new feature or stability improvement should be tested if possible.
Please follow the test instructions at the bottom of the README or use the ISO built on each PR.
Any new feature or stability improvement should be tested if possible. Please follow the test instructions at the bottom
of the README or use the ISO built on each PR.

View File

@ -1,9 +1,9 @@
import time
import json
import logging
import time
import archinstall
from archinstall.lib.hardware import hasUEFI
from archinstall.lib.profiles import Profile
if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")