From d80f8248b865ddc6401e07e44828d42a91e8f6b2 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 27 Jan 2011 21:28:00 +0100 Subject: [PATCH] distro_info.py: Change logic of _get_data_dir() to improve installation detection. --- ubuntutools/distro_info.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ubuntutools/distro_info.py b/ubuntutools/distro_info.py index ee683f3..32e1aef 100644 --- a/ubuntutools/distro_info.py +++ b/ubuntutools/distro_info.py @@ -17,7 +17,6 @@ import csv import datetime import os -import sys def convert_date(string): """Convert a date string in ISO 8601 into a datetime object.""" @@ -39,11 +38,11 @@ def convert_date(string): return date def _get_data_dir(): - """Get the data directory based on the script location.""" - if os.path.dirname(sys.argv[0]) == "/usr/bin": + """Get the data directory based on the module location.""" + if __file__.startswith("/usr/lib"): data_dir = "/usr/share/ubuntu-dev-tools" else: - data_dir = os.path.join(os.path.dirname(sys.argv[0]), "data") + data_dir = os.path.join(os.path.dirname(__file__), "..", "data") return data_dir