-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from XiaowenJiang/master
Bugfix: Fix vpdu threads belongings
- Loading branch information
Showing
3 changed files
with
55 additions
and
37 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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This script contains useful functions | ||
import sys | ||
import os | ||
|
||
install_data_dir = [ | ||
os.path.join(os.environ['HOME'], '.pdusim'), | ||
os.path.join(sys.prefix, 'pdusim'), | ||
os.path.join(sys.prefix, 'share', 'pdusim'), | ||
os.path.join(os.path.split(__file__)[0], 'pdusim'), | ||
os.path.dirname(os.path.abspath(__file__)) | ||
] | ||
|
||
|
||
def get_install_dir(): | ||
configdir_found = False | ||
for dir in install_data_dir: | ||
path = os.path.join(dir, 'conf', 'host.conf') | ||
if os.path.exists(path): | ||
return dir | ||
if not configdir_found: | ||
return None | ||
|
||
|
||
def add_third_party_to_path(): | ||
for dir in install_data_dir: | ||
path = os.path.join(dir, 'third-party') | ||
if os.path.exists(path): | ||
for d in os.listdir(path): | ||
sys.path.insert(0, os.path.join(path, d)) |
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