Browse Source

Read testing environment variable

Determine if an XDGMENUMAKER_TEST exists and equals "1". If it does,
read the .desktop files from the tests directory instead of reading the
standard systemwide and homedir .desktop files.
pull/5/head
George Vlahavas 9 years ago
parent
commit
258978281f
  1. 21
      src/xdgmenumaker

21
src/xdgmenumaker

@ -314,13 +314,20 @@ def sortedcategories(applist):
def desktopfilelist():
dirs = []
# some directories are mentioned twice in bd.xdg_data_dirs, once
# with and once without a trailing /
for i in bd.xdg_data_dirs:
i = i.rstrip('/')
if i not in dirs:
dirs.append(i)
# if this env variable is set to 1, then only read .desktop files from the
# tests directory, not systemwide. This gives a standard set of .desktop
# files to compare against for testing.
testing = os.getenv('XDGMENUMAKER_TEST')
if testing == "1":
dirs = ['../tests']
else:
dirs = []
# some directories are mentioned twice in bd.xdg_data_dirs, once
# with and once without a trailing /
for i in bd.xdg_data_dirs:
i = i.rstrip('/')
if i not in dirs:
dirs.append(i)
filelist = []
df_temp = []
for d in dirs:

Loading…
Cancel
Save