mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 07:22:29 +03:00
common.get_examples_dir() to get path to fdroidserver examples
This commit is contained in:
parent
e33684fc9b
commit
ed80391bb5
2 changed files with 24 additions and 19 deletions
|
@ -2756,3 +2756,26 @@ def is_repo_file(filename):
|
||||||
b'index-v1.json',
|
b'index-v1.json',
|
||||||
b'categories.txt',
|
b'categories.txt',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_examples_dir():
|
||||||
|
'''Return the dir where the fdroidserver example files are available'''
|
||||||
|
examplesdir = None
|
||||||
|
tmp = os.path.dirname(sys.argv[0])
|
||||||
|
if os.path.basename(tmp) == 'bin':
|
||||||
|
egg_links = glob.glob(os.path.join(tmp, '..',
|
||||||
|
'local/lib/python3.*/site-packages/fdroidserver.egg-link'))
|
||||||
|
if egg_links:
|
||||||
|
# installed from local git repo
|
||||||
|
examplesdir = os.path.join(open(egg_links[0]).readline().rstrip(), 'examples')
|
||||||
|
else:
|
||||||
|
# try .egg layout
|
||||||
|
examplesdir = os.path.dirname(os.path.dirname(__file__)) + '/share/doc/fdroidserver/examples'
|
||||||
|
if not os.path.exists(examplesdir): # use UNIX layout
|
||||||
|
examplesdir = os.path.dirname(tmp) + '/share/doc/fdroidserver/examples'
|
||||||
|
else:
|
||||||
|
# we're running straight out of the git repo
|
||||||
|
prefix = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
examplesdir = prefix + '/examples'
|
||||||
|
|
||||||
|
return examplesdir
|
||||||
|
|
|
@ -65,28 +65,10 @@ def main():
|
||||||
help=_("Do not prompt for Android SDK path, just fail"))
|
help=_("Do not prompt for Android SDK path, just fail"))
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
# find root install prefix
|
|
||||||
tmp = os.path.dirname(sys.argv[0])
|
|
||||||
examplesdir = None
|
|
||||||
if os.path.basename(tmp) == 'bin':
|
|
||||||
egg_links = glob.glob(os.path.join(tmp, '..',
|
|
||||||
'local/lib/python3.*/site-packages/fdroidserver.egg-link'))
|
|
||||||
if egg_links:
|
|
||||||
# installed from local git repo
|
|
||||||
examplesdir = os.path.join(open(egg_links[0]).readline().rstrip(), 'examples')
|
|
||||||
else:
|
|
||||||
# try .egg layout
|
|
||||||
examplesdir = os.path.dirname(os.path.dirname(__file__)) + '/share/doc/fdroidserver/examples'
|
|
||||||
if not os.path.exists(examplesdir): # use UNIX layout
|
|
||||||
examplesdir = os.path.dirname(tmp) + '/share/doc/fdroidserver/examples'
|
|
||||||
else:
|
|
||||||
# we're running straight out of the git repo
|
|
||||||
prefix = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
examplesdir = prefix + '/examples'
|
|
||||||
|
|
||||||
aapt = None
|
aapt = None
|
||||||
fdroiddir = os.getcwd()
|
fdroiddir = os.getcwd()
|
||||||
test_config = dict()
|
test_config = dict()
|
||||||
|
examplesdir = common.get_examples_dir()
|
||||||
common.fill_config_defaults(test_config)
|
common.fill_config_defaults(test_config)
|
||||||
|
|
||||||
# track down where the Android SDK is, the default is to use the path set
|
# track down where the Android SDK is, the default is to use the path set
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue