-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9984468
commit c5683cb
Showing
1 changed file
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import os | ||
import sys | ||
|
||
APPLICATION = 'exabgp' | ||
def _find_root(): | ||
root = os.environ.get('EXABGP_ROOT', '') | ||
|
||
if not root: | ||
root = os.path.normpath(os.path.dirname(sys.argv[0])) | ||
|
||
if root.endswith('/bin') or root.endswith('/sbin'): | ||
root = os.path.normpath(os.path.join(root, '..')) | ||
|
||
_index = root.find('src/exabgp/application') | ||
if _index: | ||
root = root[:_index] | ||
if root.endswith('/'): | ||
root = root[:-1] | ||
|
||
return root | ||
|
||
ROOT = os.environ.get('EXABGP_ROOT', '') | ||
if not ROOT: | ||
ROOT = os.path.normpath(os.path.dirname(sys.argv[0])) | ||
if ROOT.endswith('/bin') or ROOT.endswith('/sbin'): | ||
ROOT = os.path.normpath(os.path.join(ROOT, '..')) | ||
|
||
APPLICATION = 'exabgp' | ||
ROOT = _find_root() | ||
ETC = os.path.join(ROOT, 'etc', APPLICATION) | ||
ENVFILE = os.path.join(ETC, f'{APPLICATION}.env') | ||
|
||
|
||
|