From 5b46c04e24e3f6cc583d6d3bce2e0a1a53de06b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 15 Feb 2017 18:36:53 +0000 Subject: [PATCH] Allow absolute paths (relative to the package root). --- tools/onlpm.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index 25d11793..72d11653 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -815,9 +815,14 @@ class OnlPackageRepo(object): force: Passed to extract() as the force option.""" edir = self.extract(pkg, force=force) - for root, dirs, files in os.walk(edir): - if os.path.basename(root) == dirname and root != edir: - return root + if os.path.isabs(dirname): + apath = os.path.join(edir, dirname[1:]); + if os.path.isdir(apath): + return apath + else: + for root, dirs, files in os.walk(edir): + if os.path.basename(root) == dirname and root != edir: + return root if ex: raise OnlPackageMissingDirError(pkg, dirname)