summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Gamble2015-08-17 22:11:57 +1000
committerMatthew Gamble2015-08-17 22:11:57 +1000
commit14d9713f947b57e47f34c4ad4585a720642045e3 (patch)
treea10914a3ae173e499827811ef3b14d346d5ccc4b
downloadaur-14d9713f947b57e47f34c4ad4585a720642045e3.tar.gz
Initial commit of files
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD16
-rw-r--r--sitecustomize.py14
3 files changed, 42 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..457cf2968705
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,12 @@
+pkgbase = python-locallib
+ pkgdesc = Ensure /usr/local/lib/pythonX is in sys.path
+ pkgver = 1.0.0
+ pkgrel = 1
+ arch = any
+ license = UNLICENSE
+ depends = python
+ source = sitecustomize.py
+ sha256sums = 8ef1427696ee397b8d5ea081c04054e604648650aedbd609cbc5ad5a9de456bd
+
+pkgname = python-locallib
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..371ddbeb879e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,16 @@
+# Maintainer: Matthew Gamble
+
+pkgname=python-locallib
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="Ensure /usr/local/lib/pythonX is in sys.path"
+arch=('any')
+license=('UNLICENSE')
+depends=('python')
+source=("sitecustomize.py")
+sha256sums=('8ef1427696ee397b8d5ea081c04054e604648650aedbd609cbc5ad5a9de456bd')
+
+package() {
+ sitepkgs_dir=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+ install -Dm644 sitecustomize.py "${pkgdir}${sitepkgs_dir}/sitecustomize.py"
+}
diff --git a/sitecustomize.py b/sitecustomize.py
new file mode 100644
index 000000000000..49110b39299a
--- /dev/null
+++ b/sitecustomize.py
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+
+import os, sys
+
+cur_path = os.path.dirname(os.path.realpath(__file__))
+path_segments = []
+for segment in reversed(cur_path.lstrip("/").split("/")):
+ path_segments.insert(0, segment)
+ if segment == "lib":
+ path_segments.insert(0, "local")
+
+sys.path.insert(0, "/" + os.path.join(*path_segments))
+path_segments.pop()
+sys.path.insert(1, "/" + os.path.join(*path_segments))