aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-13 16:47:17 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-13 16:47:17 +0200
commitfdce09d3c0e455fcf11d93c7c92aa0f761caaab9 (patch)
treee3485170e5d74389e4ef5284a18083ea115b4e0c
parentebuild string substitution modified as suggested by Brian Dolbec (diff)
downloadgs-elpa-fdce09d3c0e455fcf11d93c7c92aa0f761caaab9.tar.gz
gs-elpa-fdce09d3c0e455fcf11d93c7c92aa0f761caaab9.tar.bz2
gs-elpa-fdce09d3c0e455fcf11d93c7c92aa0f761caaab9.zip
get_pkgpath modified as suggested by Brian Dolbec
-rw-r--r--g_elpa/backend.py5
-rw-r--r--g_elpa/ebuild.py7
-rw-r--r--g_elpa/fileutils.py14
3 files changed, 6 insertions, 20 deletions
diff --git a/g_elpa/backend.py b/g_elpa/backend.py
index e3406ba..b77ed2e 100644
--- a/g_elpa/backend.py
+++ b/g_elpa/backend.py
@@ -16,14 +16,15 @@ import os
from g_sorcery.backend import Backend
from g_sorcery.metadata import MetadataGenerator
from g_sorcery.eclass import EclassGenerator
+from g_sorcery.fileutils import get_pkgpath
from .elpa_db import ElpaDB
from .ebuild import ElpaEbuildWithDigestGenerator, ElpaEbuildWithoutDigestGenerator
-from .fileutils import get_pkgpath
+
class ElpaEclassGenerator(EclassGenerator):
def __init__(self):
- super(ElpaEclassGenerator, self).__init__(os.path.join(get_pkgpath(), 'data'))
+ super(ElpaEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data'))
instance = Backend(ElpaDB,
diff --git a/g_elpa/ebuild.py b/g_elpa/ebuild.py
index 8e20ee3..a9df7ed 100644
--- a/g_elpa/ebuild.py
+++ b/g_elpa/ebuild.py
@@ -14,15 +14,14 @@
import os
from g_sorcery.ebuild import EbuildGeneratorFromFile
-
-from .fileutils import get_pkgpath
+from g_sorcery.fileutils import get_pkgpath
class ElpaEbuildWithDigestGenerator(EbuildGeneratorFromFile):
def __init__(self, package_db):
- name = os.path.join(get_pkgpath(), 'data/ebuild_with_digest.tmpl')
+ name = os.path.join(get_pkgpath(__file__), 'data/ebuild_with_digest.tmpl')
super(ElpaEbuildWithDigestGenerator, self).__init__(package_db, filename = name)
class ElpaEbuildWithoutDigestGenerator(EbuildGeneratorFromFile):
def __init__(self, package_db):
- name = os.path.join(get_pkgpath(), 'data/ebuild_without_digest.tmpl')
+ name = os.path.join(get_pkgpath(__file__), 'data/ebuild_without_digest.tmpl')
super(ElpaEbuildWithoutDigestGenerator, self).__init__(package_db, filename = name)
diff --git a/g_elpa/fileutils.py b/g_elpa/fileutils.py
index 685ef2f..035274c 100644
--- a/g_elpa/fileutils.py
+++ b/g_elpa/fileutils.py
@@ -10,17 +10,3 @@
:copyright: (c) 2013 by Jauhien Piatlicki
:license: GPL-2, see LICENSE for more details.
"""
-
-import os
-
-def get_pkgpath():
- """
- Get package path.
-
- Returns:
- Package path.
- """
- root = __file__
- if os.path.islink(root):
- root = os.path.realpath(root)
- return os.path.dirname(os.path.abspath(root))