Can now install in Gentoo.
This commit is contained in:
parent
f3b54ad1fc
commit
3f7fdfe443
4 changed files with 63 additions and 31 deletions
|
|
@ -25,6 +25,11 @@ elif [ $DIST_ID == "debian" ]; then
|
||||||
DEPS="python3-pyinotify python3-pygments python3-docopt python3-pillow"
|
DEPS="python3-pyinotify python3-pygments python3-docopt python3-pillow"
|
||||||
sudo apt --yes install python3-pip
|
sudo apt --yes install python3-pip
|
||||||
sudo pip3 install distro
|
sudo pip3 install distro
|
||||||
|
elif [ $DIST_ID == "gentoo" ]; then
|
||||||
|
INSTALL_CMD="emerge --noreplace"
|
||||||
|
DEPS="pyinotify pygments docopt pillow"
|
||||||
|
emerge --noreplace dev-python/pip
|
||||||
|
sudo pip3 install --user distro
|
||||||
else
|
else
|
||||||
INSTALL_CMD="apt --yes install"
|
INSTALL_CMD="apt --yes install"
|
||||||
DEPS="python3-distro python3-pyinotify python3-pygments python3-docopt python3-pillow"
|
DEPS="python3-distro python3-pyinotify python3-pygments python3-docopt python3-pillow"
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,15 @@ cmd_for_dist = {"ubuntu": ["apt-get", "-y", "install"],
|
||||||
"debian": ["apt-get", "-y", "install"],
|
"debian": ["apt-get", "-y", "install"],
|
||||||
"fedora": ["dnf", "-y", "install"],
|
"fedora": ["dnf", "-y", "install"],
|
||||||
"arch": ["pacman", "-S", "--noconfirm", "--needed"],
|
"arch": ["pacman", "-S", "--noconfirm", "--needed"],
|
||||||
"opensuse": ["zypper", "-n", "install"]}
|
"opensuse": ["zypper", "-n", "install"],
|
||||||
if pip_deps:
|
"gentoo": ["emerge", "--noreplace"]}
|
||||||
dist_deps.add("python2-pip" if dist_id == "arch" else "python-pip")
|
if dist_id == "gentoo":
|
||||||
if pip3_deps:
|
dist_deps.add("pip")
|
||||||
dist_deps.add("python-pip" if dist_id == "arch" else "python3-pip")
|
else:
|
||||||
|
if pip_deps:
|
||||||
|
dist_deps.add("python2-pip" if dist_id == "arch" else "python-pip")
|
||||||
|
if pip3_deps:
|
||||||
|
dist_deps.add("python-pip" if dist_id == "arch" else "python3-pip")
|
||||||
if dist_deps:
|
if dist_deps:
|
||||||
subprocess.check_call(["sudo"] + cmd_for_dist[dist_id] + list(dist_deps))
|
subprocess.check_call(["sudo"] + cmd_for_dist[dist_id] + list(dist_deps))
|
||||||
if pip_deps:
|
if pip_deps:
|
||||||
|
|
|
||||||
|
|
@ -127,10 +127,27 @@ function remove_pixel {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function build_gentoo {
|
||||||
|
TAR_FILE="stage3-amd64-20170525.tar.bz2"
|
||||||
|
wget --continue "http://distfiles.gentoo.org/releases/amd64/autobuilds/20170525/$TAR_FILE"
|
||||||
|
mkdir -p gentoo.part
|
||||||
|
sudo tar --directory=gentoo.part -xjf $TAR_FILE
|
||||||
|
rm $TAR_FILE
|
||||||
|
run_in_container gentoo.part emerge --sync
|
||||||
|
run_in_container gentoo.part emerge sudo
|
||||||
|
mv gentoo.part gentoo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function remove_gentoo {
|
||||||
|
sudo rm -rf gentoo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[ $# -eq 0 ] && WORK_PATH=$(mktemp -d --suffix=-vigil) || WORK_PATH="$1"
|
[ $# -eq 0 ] && WORK_PATH=$(mktemp -d --suffix=-vigil) || WORK_PATH="$1"
|
||||||
sudo apt-get install -y systemd-container debootstrap xz-utils wget
|
sudo apt-get install -y systemd-container debootstrap xz-utils wget
|
||||||
cd $WORK_PATH
|
cd $WORK_PATH
|
||||||
for DISTRIBUTION in ubuntu fedora debian archlinux opensuse pixel; do
|
for DISTRIBUTION in ubuntu fedora debian archlinux opensuse pixel gentoo; do
|
||||||
if [ -e $DISTRIBUTION ]; then
|
if [ -e $DISTRIBUTION ]; then
|
||||||
echo "$DISTRIBUTION container already exists."
|
echo "$DISTRIBUTION container already exists."
|
||||||
else
|
else
|
||||||
|
|
|
||||||
56
tools.py
56
tools.py
|
|
@ -271,7 +271,7 @@ def metadata(path):
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python3-pygments"}, arch_deps={"python-pygments"},
|
@deps(deps={"python3-pygments"}, arch_deps={"python-pygments"},
|
||||||
opensuse_deps={"python3-Pygments"})
|
opensuse_deps={"python3-Pygments"}, gentoo_deps={"pygments"})
|
||||||
def contents(path):
|
def contents(path):
|
||||||
root, ext = splitext(path)
|
root, ext = splitext(path)
|
||||||
if ext == "":
|
if ext == "":
|
||||||
|
|
@ -304,7 +304,7 @@ def _python_version(path): # Need a better hueristic
|
||||||
return "python3"
|
return "python3"
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python", "python3"},
|
@deps(deps={"python", "python3"}, gentoo_deps={"python"},
|
||||||
url="https://en.wikipedia.org/wiki/Python_syntax_and_semantics")
|
url="https://en.wikipedia.org/wiki/Python_syntax_and_semantics")
|
||||||
def python_syntax(path):
|
def python_syntax(path):
|
||||||
python_version = _python_version(path)
|
python_version = _python_version(path)
|
||||||
|
|
@ -321,7 +321,7 @@ def _is_python_test_file(path):
|
||||||
return path.endswith("_test.py") or path.startswith("test_")
|
return path.endswith("_test.py") or path.startswith("test_")
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python", "python3"},
|
@deps(deps={"python", "python3"}, gentoo_deps={"python"},
|
||||||
url="https://docs.python.org/3/library/unittest.html")
|
url="https://docs.python.org/3/library/unittest.html")
|
||||||
def python_unittests(path):
|
def python_unittests(path):
|
||||||
if _is_python_test_file(path):
|
if _is_python_test_file(path):
|
||||||
|
|
@ -336,7 +336,7 @@ def python_unittests(path):
|
||||||
|
|
||||||
@deps(deps={"python", "python3"},
|
@deps(deps={"python", "python3"},
|
||||||
url="https://docs.python.org/3/library/pydoc.html",
|
url="https://docs.python.org/3/library/pydoc.html",
|
||||||
executables={"pydoc", "pydoc3"})
|
executables={"pydoc", "pydoc3"}, missing_in={"gentoo"})
|
||||||
def pydoc(path):
|
def pydoc(path):
|
||||||
pydoc_exe = "pydoc3" if _python_version(path) == "python3" else "pydoc"
|
pydoc_exe = "pydoc3" if _python_version(path) == "python3" else "pydoc"
|
||||||
status, output = Status.normal, ""
|
status, output = Status.normal, ""
|
||||||
|
|
@ -352,7 +352,7 @@ def pydoc(path):
|
||||||
|
|
||||||
@deps(deps={"mypy"}, url="mypy", fedora_deps={"python3-mypy"},
|
@deps(deps={"mypy"}, url="mypy", fedora_deps={"python3-mypy"},
|
||||||
debian_deps={"pip3/mypy"}, arch_deps={"pip3/mypy"},
|
debian_deps={"pip3/mypy"}, arch_deps={"pip3/mypy"},
|
||||||
opensuse_deps={"pip3/mypy"}, executables={"mypy"})
|
opensuse_deps={"pip3/mypy"}, executables={"mypy"}, missing_in={"gentoo"})
|
||||||
def mypy(path):
|
def mypy(path):
|
||||||
stdout, stderr, returncode = _do_command(["mypy", path], timeout=TIMEOUT)
|
stdout, stderr, returncode = _do_command(["mypy", path], timeout=TIMEOUT)
|
||||||
status = Status.ok if returncode == 0 else Status.normal
|
status = Status.ok if returncode == 0 else Status.normal
|
||||||
|
|
@ -369,7 +369,7 @@ def _colorize_coverage_report(text):
|
||||||
@deps(deps={"python-coverage", "python3-coverage"},
|
@deps(deps={"python-coverage", "python3-coverage"},
|
||||||
arch_deps={"python2-coverage", "python-coverage"},
|
arch_deps={"python2-coverage", "python-coverage"},
|
||||||
opensuse_deps={"python2-coverage", "python3-coverage"},
|
opensuse_deps={"python2-coverage", "python3-coverage"},
|
||||||
url="python3-coverage")
|
gentoo_deps={"coverage"}, url="python3-coverage")
|
||||||
def python_coverage(path):
|
def python_coverage(path):
|
||||||
# FIX: Also use test_*.py files.
|
# FIX: Also use test_*.py files.
|
||||||
test_path = path[:-(len(".py"))] + "_test.py"
|
test_path = path[:-(len(".py"))] + "_test.py"
|
||||||
|
|
@ -394,7 +394,7 @@ def python_coverage(path):
|
||||||
"No corresponding test file: " + os.path.normpath(test_path))
|
"No corresponding test file: " + os.path.normpath(test_path))
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python", "python3"},
|
@deps(deps={"python", "python3"}, gentoo_deps={"python"},
|
||||||
url="https://docs.python.org/3/library/profile.html")
|
url="https://docs.python.org/3/library/profile.html")
|
||||||
def python_profile(path):
|
def python_profile(path):
|
||||||
stdout, *rest = _do_command([_python_version(path), "-m", "cProfile",
|
stdout, *rest = _do_command([_python_version(path), "-m", "cProfile",
|
||||||
|
|
@ -407,13 +407,14 @@ def python_profile(path):
|
||||||
debian_deps={"pip/pycodestyle", "pip3/pycodestyle"},
|
debian_deps={"pip/pycodestyle", "pip3/pycodestyle"},
|
||||||
arch_deps={"python-pycodestyle", "python2-pycodestyle"},
|
arch_deps={"python-pycodestyle", "python2-pycodestyle"},
|
||||||
opensuse_deps={"python2-pycodestyle", "python3-pycodestyle"},
|
opensuse_deps={"python2-pycodestyle", "python3-pycodestyle"},
|
||||||
url="python-pycodestyle")
|
gentoo_deps={"pycodestyle"}, url="python-pycodestyle")
|
||||||
def pycodestyle(path):
|
def pycodestyle(path):
|
||||||
return _run_command([_python_version(path), "-m", "pycodestyle", path])
|
return _run_command([_python_version(path), "-m", "pycodestyle", path])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"pyflakes"}, arch_deps={"python2-pyflakes", "python-pyflakes"},
|
@deps(deps={"pyflakes"}, arch_deps={"python2-pyflakes", "python-pyflakes"},
|
||||||
opensuse_deps={"python2-pyflakes", "python3-pyflakes"}, url="pyflakes")
|
opensuse_deps={"python2-pyflakes", "python3-pyflakes"}, url="pyflakes",
|
||||||
|
missing_in={"gentoo"})
|
||||||
def pyflakes(path):
|
def pyflakes(path):
|
||||||
return _run_command([_python_version(path), "-m", "pyflakes", path])
|
return _run_command([_python_version(path), "-m", "pyflakes", path])
|
||||||
|
|
||||||
|
|
@ -421,7 +422,8 @@ def pyflakes(path):
|
||||||
@deps(deps={"pylint", "pylint3"}, fedora_deps={"pylint", "python3-pylint"},
|
@deps(deps={"pylint", "pylint3"}, fedora_deps={"pylint", "python3-pylint"},
|
||||||
arch_deps={"python2-pylint", "python-pylint"},
|
arch_deps={"python2-pylint", "python-pylint"},
|
||||||
opensuse_deps={"python2-pylint", "python3-pylint"},
|
opensuse_deps={"python2-pylint", "python3-pylint"},
|
||||||
debian_deps={"pip/pylint", "pip3/pylint"}, url="pylint3")
|
debian_deps={"pip/pylint", "pip3/pylint"}, gentoo_deps={"pylint"},
|
||||||
|
url="pylint3")
|
||||||
def pylint(path):
|
def pylint(path):
|
||||||
return _run_command([_python_version(path), "-m", "pylint",
|
return _run_command([_python_version(path), "-m", "pylint",
|
||||||
"--errors-only", path])
|
"--errors-only", path])
|
||||||
|
|
@ -435,7 +437,7 @@ def python_gut(path):
|
||||||
return Status.normal, source_widget
|
return Status.normal, source_widget
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python", "python3"},
|
@deps(deps={"python", "python3"}, gentoo_deps={"python"},
|
||||||
url="https://docs.python.org/3/library/modulefinder.html")
|
url="https://docs.python.org/3/library/modulefinder.html")
|
||||||
def python_modulefinder(path):
|
def python_modulefinder(path):
|
||||||
return _run_command([_python_version(path), "-m", "modulefinder", path],
|
return _run_command([_python_version(path), "-m", "modulefinder", path],
|
||||||
|
|
@ -456,7 +458,8 @@ def _colorize_mccabe(text, python_version):
|
||||||
|
|
||||||
@deps(deps={"python-mccabe", "python3-mccabe"},
|
@deps(deps={"python-mccabe", "python3-mccabe"},
|
||||||
arch_deps={"python2-mccabe", "python-mccabe"},
|
arch_deps={"python2-mccabe", "python-mccabe"},
|
||||||
opensuse_deps={"python2-mccabe", "python3-mccabe"}, url="python3-mccabe")
|
opensuse_deps={"python2-mccabe", "python3-mccabe"},
|
||||||
|
gentoo_deps={"mccabe"}, url="python3-mccabe")
|
||||||
def python_mccabe(path):
|
def python_mccabe(path):
|
||||||
python_version = _python_version(path)
|
python_version = _python_version(path)
|
||||||
stdout, *rest = _do_command([python_version, "-m", "mccabe", path])
|
stdout, *rest = _do_command([python_version, "-m", "mccabe", path])
|
||||||
|
|
@ -485,7 +488,7 @@ def disassemble_pyc(path):
|
||||||
|
|
||||||
@deps(deps={"python-bandit", "python3-bandit"}, fedora_deps={"bandit"},
|
@deps(deps={"python-bandit", "python3-bandit"}, fedora_deps={"bandit"},
|
||||||
debian_deps={"pip/bandit", "pip3/bandit"}, arch_deps={"bandit"},
|
debian_deps={"pip/bandit", "pip3/bandit"}, arch_deps={"bandit"},
|
||||||
opensuse_deps={"pip/bandit", "pip3/bandit"},
|
opensuse_deps={"pip/bandit", "pip3/bandit"}, gentoo_deps={"bandit"},
|
||||||
url="python3-bandit")
|
url="python3-bandit")
|
||||||
def bandit(path):
|
def bandit(path):
|
||||||
python_version = _python_version(path)
|
python_version = _python_version(path)
|
||||||
|
|
@ -510,8 +513,8 @@ def perl_syntax(path):
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"perl-doc"}, fedora_deps={"perl-Pod-Perldoc"},
|
@deps(deps={"perl-doc"}, fedora_deps={"perl-Pod-Perldoc"},
|
||||||
arch_deps={"perl-pod-perldoc"}, url="http://perldoc.perl.org/",
|
arch_deps={"perl-pod-perldoc"}, gentoo_deps={"perl-IO"},
|
||||||
executables={"perldoc"})
|
url="http://perldoc.perl.org/", executables={"perldoc"})
|
||||||
def perldoc(path):
|
def perldoc(path):
|
||||||
stdout, stderr, returncode = _do_command(["perldoc", "-t", path])
|
stdout, stderr, returncode = _do_command(["perldoc", "-t", path])
|
||||||
return ((Status.normal, fill3.Text(stdout)) if returncode == 0
|
return ((Status.normal, fill3.Text(stdout)) if returncode == 0
|
||||||
|
|
@ -519,7 +522,7 @@ def perldoc(path):
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"perltidy"}, arch_deps={"perl-test-perltidy"},
|
@deps(deps={"perltidy"}, arch_deps={"perl-test-perltidy"},
|
||||||
opensuse_deps={"perl-Test-PerlTidy"},
|
opensuse_deps={"perl-Test-PerlTidy"}, gentoo_deps={"Perl-Tidy"},
|
||||||
url="http://perltidy.sourceforge.net/", executables={"perltidy"})
|
url="http://perltidy.sourceforge.net/", executables={"perltidy"})
|
||||||
def perltidy(path):
|
def perltidy(path):
|
||||||
stdout, *rest = _do_command(["perltidy", "-st", path])
|
stdout, *rest = _do_command(["perltidy", "-st", path])
|
||||||
|
|
@ -536,7 +539,8 @@ def c_syntax_gcc(path):
|
||||||
return _run_command(["gcc", "-fsyntax-only", path])
|
return _run_command(["gcc", "-fsyntax-only", path])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"clang"}, url="http://clang.llvm.org/", executables={"clang"})
|
@deps(deps={"clang"}, url="http://clang.llvm.org/", executables={"clang"},
|
||||||
|
missing_in={"gentoo"})
|
||||||
def c_syntax_clang(path):
|
def c_syntax_clang(path):
|
||||||
return _run_command(["clang", "-fsyntax-only", path])
|
return _run_command(["clang", "-fsyntax-only", path])
|
||||||
|
|
||||||
|
|
@ -593,12 +597,13 @@ def nm(path):
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"python-pdfminer"}, arch_deps=set(), url="python-pdfminer",
|
@deps(deps={"python-pdfminer"}, arch_deps=set(), url="python-pdfminer",
|
||||||
executables={"pdf2txt"}, missing_in={"arch", "fedora", "opensuse"})
|
executables={"pdf2txt"}, missing_in={"arch", "fedora", "opensuse",
|
||||||
|
"gentoo"})
|
||||||
def pdf2txt(path):
|
def pdf2txt(path):
|
||||||
return _run_command(["pdf2txt", path], Status.normal)
|
return _run_command(["pdf2txt", path], Status.normal)
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"tidy"}, url="tidy", executables={"tidy"})
|
@deps(deps={"tidy"}, url="tidy", executables={"tidy"}, missing_in={"gentoo"})
|
||||||
def html_syntax(path):
|
def html_syntax(path):
|
||||||
# Maybe only show errors
|
# Maybe only show errors
|
||||||
stdout, stderr, returncode = _do_command(["tidy", path])
|
stdout, stderr, returncode = _do_command(["tidy", path])
|
||||||
|
|
@ -606,14 +611,14 @@ def html_syntax(path):
|
||||||
return status, fill3.Text(stderr)
|
return status, fill3.Text(stderr)
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"tidy"}, url="tidy", executables={"tidy"})
|
@deps(deps={"tidy"}, url="tidy", executables={"tidy"}, missing_in={"gentoo"})
|
||||||
def tidy(path):
|
def tidy(path):
|
||||||
stdout, *rest = _do_command(["tidy", path])
|
stdout, *rest = _do_command(["tidy", path])
|
||||||
return Status.normal, fill3.Text(stdout)
|
return Status.normal, fill3.Text(stdout)
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"html2text"}, arch_deps={"python-html2text"}, url="html2text",
|
@deps(deps={"html2text"}, arch_deps={"python-html2text"},
|
||||||
executables={"html2text"})
|
url="html2text", executables={"html2text"}, missing_in={"gentoo"})
|
||||||
def html2text(path):
|
def html2text(path):
|
||||||
return _run_command(["html2text", path], Status.normal)
|
return _run_command(["html2text", path], Status.normal)
|
||||||
|
|
||||||
|
|
@ -623,7 +628,8 @@ def cpp_syntax_gcc(path):
|
||||||
return _run_command(["gcc", "-fsyntax-only", path])
|
return _run_command(["gcc", "-fsyntax-only", path])
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"clang"}, url="http://clang.llvm.org/", executables={"clang"})
|
@deps(deps={"clang"}, url="http://clang.llvm.org/", executables={"clang"},
|
||||||
|
missing_in={"gentoo"})
|
||||||
def cpp_syntax_clang(path):
|
def cpp_syntax_clang(path):
|
||||||
return _run_command(["clang", "-fsyntax-only", path])
|
return _run_command(["clang", "-fsyntax-only", path])
|
||||||
|
|
||||||
|
|
@ -675,7 +681,7 @@ def _resize_image(image, new_width):
|
||||||
|
|
||||||
@deps(deps={"python3-pil"}, fedora_deps={"python3-pillow"},
|
@deps(deps={"python3-pil"}, fedora_deps={"python3-pillow"},
|
||||||
arch_deps={"python-pillow"}, opensuse_deps={"python3-Pillow"},
|
arch_deps={"python-pillow"}, opensuse_deps={"python3-Pillow"},
|
||||||
url="python3-pil")
|
gentoo_deps={"pillow"}, url="python3-pil")
|
||||||
def pil(path):
|
def pil(path):
|
||||||
with open(path, "rb") as image_file:
|
with open(path, "rb") as image_file:
|
||||||
with PIL.Image.open(image_file).convert("RGB") as image:
|
with PIL.Image.open(image_file).convert("RGB") as image:
|
||||||
|
|
@ -694,7 +700,7 @@ def pil(path):
|
||||||
|
|
||||||
@deps(deps={"python3-pil"}, fedora_deps={"python3-pillow"},
|
@deps(deps={"python3-pil"}, fedora_deps={"python3-pillow"},
|
||||||
arch_deps={"python-pillow"}, opensuse_deps={"python3-Pillow"},
|
arch_deps={"python-pillow"}, opensuse_deps={"python3-Pillow"},
|
||||||
url="python3-pil")
|
gentoo_deps={"pillow"}, url="python3-pil")
|
||||||
def pil_half(path):
|
def pil_half(path):
|
||||||
with open(path, "rb") as image_file:
|
with open(path, "rb") as image_file:
|
||||||
with PIL.Image.open(image_file).convert("RGB") as image:
|
with PIL.Image.open(image_file).convert("RGB") as image:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue