diff options
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | 010-disablepip.patch | 92 | ||||
-rw-r--r-- | PKGBUILD | 23 |
4 files changed, 121 insertions, 13 deletions
@@ -1,14 +1,19 @@ -pkgbase = khinsider +pkgbase = khinsider-git pkgdesc = A script for mass downloads from downloads.khinsider.com - pkgver = r68.d2d031a + pkgver = r77.b1683fb pkgrel = 1 url = https://github.com/obskyr/khinsider arch = any license = unknown makedepends = git depends = python + depends = python-beautifulsoup4 + depends = python-requests + provides = khinsider + conflicts = khinsider source = git+https://github.com/obskyr/khinsider.git - md5sums = SKIP - -pkgname = khinsider + source = 010-disablepip.patch + sha256sums = SKIP + sha256sums = 0f3aa4c853f592b1fe7baa38e3d2d16fa1adc2f45e8cfd7461320b63907e0086 +pkgname = khinsider-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..32b012c5c4e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/*.tar* +/pkg +/src +khinsider
\ No newline at end of file diff --git a/010-disablepip.patch b/010-disablepip.patch new file mode 100644 index 000000000000..bd86bb052034 --- /dev/null +++ b/010-disablepip.patch @@ -0,0 +1,92 @@ +--- a/khinsider.py ++++ b/khinsider.py +@@ -35,89 +35,7 @@ + sys.stderr = self._stderr + + +-# --- Install prerequisites --- + +-# (This section in `if __name__ == '__main__':` is entirely unrelated to the +-# rest of the module, and doesn't even run if the module isn't run by itself.) +- +-if __name__ == '__main__': +- # To check for the existence of modules without importing them. +- # Apparently imp and importlib are a forest of deprecation! +- # The API was changed once in 3.3 (deprecating imp), +- # and then again in 3.4 (deprecating the 3.3 API). +- # So.... we have to do this dance to avoid deprecation warnings. +- try: +- try: +- from importlib.util import find_spec as find_module # Python 3.4+ +- except ImportError: +- from importlib import find_loader as find_module # Python 3.3 +- except ImportError: +- from imp import find_module # Python 2 +- +- # User-friendly name, import name, pip specification. +- requiredModules = [ +- ['requests', 'requests', 'requests >= 2.0.0, < 3.0.0'], +- ['Beautiful Soup 4', 'bs4', 'beautifulsoup4 >= 4.4.0, < 5.0.0'] +- ] +- +- def moduleExists(name): +- try: +- result = find_module(name) +- except ImportError: +- return False +- else: +- return result is not None +- def neededInstalls(requiredModules=requiredModules): +- uninstalledModules = [] +- for module in requiredModules: +- if not moduleExists(module[1]): +- uninstalledModules.append(module) +- return uninstalledModules +- +- def install(package): +- nowhere = open(os.devnull, 'w') +- exitStatus = subprocess.call([sys.executable, '-m', 'pip', 'install', package], +- stdout=nowhere, +- stderr=nowhere) +- if exitStatus != 0: +- raise OSError("Failed to install package.") +- def installModules(modules, verbose=True): +- for module in modules: +- if verbose: +- print("Installing {}...".format(module[0])) +- +- try: +- install(module[2]) +- except OSError as e: +- if verbose: +- print("Failed to install {}. " +- "You may need to run the script as an administrator " +- "or superuser.".format(module[0]), +- file=sys.stderr) +- print("You can also try to install the package manually " +- "(pip install \"{}\")".format(module[2]), +- file=sys.stderr) +- raise e +- def installRequiredModules(needed=None, verbose=True): +- needed = neededInstalls() if needed is None else needed +- installModules(neededInstalls(), verbose) +- +- needed = neededInstalls() +- if needed: +- if moduleExists('pip'): +- # Needed to call pip the official way. +- import subprocess +- else: +- print("You don't seem to have pip installed!", file=sys.stderr) +- print("Get it from https://pip.readthedocs.org/en/latest/installing.html", file=sys.stderr) +- sys.exit(1) +- +- try: +- installRequiredModules(needed) +- except OSError: +- sys.exit(1) +- +-# ------ + + import requests + from bs4 import BeautifulSoup @@ -1,23 +1,30 @@ -# Maintainer: Doommsatic <keniscoolu@gmail.com> -pkgname=khinsider -pkgver=r68.d2d031a +# Maintainer: Nathaniel Chin <thegamingorangutans+aur at gmail.com> +# Contributor: Doommsatic <keniscoolu@gmail.com> +pkgname=khinsider-git +pkgver=r77.b1683fb pkgrel=1 pkgdesc="A script for mass downloads from downloads.khinsider.com" arch=('any') url="https://github.com/obskyr/khinsider" license=('unknown') -depends=('python') +depends=('python' 'python-beautifulsoup4' 'python-requests') makedepends=('git') -source=('git+https://github.com/obskyr/khinsider.git') -md5sums=('SKIP') +source=('git+https://github.com/obskyr/khinsider.git' "010-disablepip.patch") +sha256sums=('SKIP' '0f3aa4c853f592b1fe7baa38e3d2d16fa1adc2f45e8cfd7461320b63907e0086') +provides=('khinsider') +conflicts=('khinsider') + +prepare() { + patch -d khinsider -Np1 -i "${srcdir}/010-disablepip.patch" +} pkgver() { - cd "$srcdir/${pkgname}" + cd "$srcdir/khinsider" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } package() { - cd "$srcdir/${pkgname%-VCS}" + cd "$srcdir/khinsider" install -Dm755 khinsider.py "${pkgdir}/usr/bin/khinsider" install -Dm644 readme.md "${pkgdir}/usr/share/doc/khinsider/readme.md" } |