mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-10 08:21:29 +00:00
distro_info.py: Change logic of _get_data_dir() to improve installation detection.
This commit is contained in:
parent
55d8398445
commit
d80f8248b8
@ -17,7 +17,6 @@
|
|||||||
import csv
|
import csv
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
def convert_date(string):
|
def convert_date(string):
|
||||||
"""Convert a date string in ISO 8601 into a datetime object."""
|
"""Convert a date string in ISO 8601 into a datetime object."""
|
||||||
@ -39,11 +38,11 @@ def convert_date(string):
|
|||||||
return date
|
return date
|
||||||
|
|
||||||
def _get_data_dir():
|
def _get_data_dir():
|
||||||
"""Get the data directory based on the script location."""
|
"""Get the data directory based on the module location."""
|
||||||
if os.path.dirname(sys.argv[0]) == "/usr/bin":
|
if __file__.startswith("/usr/lib"):
|
||||||
data_dir = "/usr/share/ubuntu-dev-tools"
|
data_dir = "/usr/share/ubuntu-dev-tools"
|
||||||
else:
|
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
|
return data_dir
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user