-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added checks to see if we have pyuic4 and pyrcc4 in the path
- Loading branch information
Showing
3 changed files
with
84 additions
and
27 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
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,44 @@ | ||
""" | ||
/*************************************************************************** | ||
pb_tool utilities | ||
A tool for building and deploying QGIS plugins | ||
------------------- | ||
begin : 2014-09-24 | ||
copyright : (C) 2014 by GeoApt LLC | ||
email : gsherman@geoapt.com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
""" | ||
def check_path(app): | ||
""" Adapted form StackExchange: | ||
http://stackoverflow.com/questions/377017 | ||
""" | ||
import os | ||
def is_exe(fpath): | ||
return os.path.exists(fpath) and os.access(fpath, os.X_OK) | ||
|
||
def ext_candidates(fpath): | ||
yield fpath | ||
for ext in os.environ.get("PATHEXT", "").split(os.pathsep): | ||
yield fpath + ext | ||
|
||
fpath, fname = os.path.split(app) | ||
if fpath: | ||
if is_exe(app): | ||
return app | ||
else: | ||
for path in os.environ["PATH"].split(os.pathsep): | ||
exe_file = os.path.join(path, app) | ||
for candidate in ext_candidates(exe_file): | ||
if is_exe(candidate): | ||
return candidate | ||
|
||
return None |