Skip to content

Commit

Permalink
Added CQtDeployerConfig.hiddenDependencies attribute / implementation…
Browse files Browse the repository at this point in the history
…. Added QtCppConfig.toQtPath dynamic relative path resolution function. Added normLibName utility function to resolve dll vs so file extensions across platforms.
  • Loading branch information
BuvinJ committed Dec 11, 2020
1 parent 891d020 commit 72073fe
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
1 change: 1 addition & 0 deletions distbuilder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
, rootFileName \
, normBinaryName \
, normIconName \
, normLibName \
, copyToDir \
, moveToDir \
, removeFromDir \
Expand Down
2 changes: 1 addition & 1 deletion distbuilder/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.8.2"
__version__ = "0.7.8.2.1"
29 changes: 24 additions & 5 deletions distbuilder/qt_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def qtDirPath( self ):
head, tail = splitPath( qtDir )
if tail=="bin" : qtDir=head
return qtDir


def toQtPath( self, relativePath ):
return absPath( relativePath, self.qtDirPath() )

def validate( self ):
if self.qtBinDirPath is None:
self.qtBinDirPath = getEnv( QT_BIN_DIR_ENV_VAR )
Expand Down Expand Up @@ -243,6 +246,21 @@ def __useCqtdeployer( self, destDirPath, exePath ):
dest = joinPath( qmlDestDirPath, subDir )
print( "Copying %s to %s..." % (src, dest) )
copyDir( src, dest )
# inject any other missing dependencies
if cfg and len(cfg.hiddenDependencies) > 0:
for depend in cfg.hiddenDependencies:
src, dest = util._toSrcDestPair( depend, destDir=destDirPath )
print( 'Copying "%s" to "%s"...' % ( src, dest ) )
if isFile( src ) :
destDir = dirPath( dest )
if not exists( destDir ): makeDir( destDir )
try: copyFile( src, dest )
except Exception as e: printExc( e )
elif isDir( src ):
try: copyDir( src, dest )
except Exception as e: printExc( e )
else:
printErr( 'Invalid path: "%s"' % (src,) )
# return the path to the exe produced
return exePath

Expand All @@ -269,10 +287,11 @@ def __useLdd( self, destDirPath, exePath ):
class CQtDeployerConfig:

def __init__( self ):
self.libDirs = []
self.plugins = []
self.hiddenQml = []

self.libDirs = []
self.plugins = []
self.hiddenQml = []
self.hiddenDependencies = []

self.ignoreLibs = []
self.ignoreEnv = []

Expand Down
15 changes: 15 additions & 0 deletions distbuilder/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
_MACOS_ICON_EXT = ".icns"
_LINUX_ICON_EXT = ".png"

# library types across the platforms
_WINDOWS_LIB_EXT = ".dll"
_MACOS_LIB_EXT = ".so"
_LINUX_LIB_EXT = ".so"

__NOT_SUPPORTED_MSG = ( "Sorry this operation is not supported " +
"this for this platform!" )

Expand Down Expand Up @@ -536,6 +541,16 @@ def normIconName( path, isPathPreserved=False ):
elif IS_LINUX: return "%s%s" % (base, _LINUX_ICON_EXT)
raise Exception( __NOT_SUPPORTED_MSG )
return base

def normLibName( path, isPathPreserved=False ):
if path is None : return None
if not isPathPreserved : path = fileBaseName( path )
base, _ = splitExt( path )
if IS_WINDOWS: return "%s%s" % (base, _WINDOWS_LIB_EXT)
elif IS_MACOS: return "%s%s" % (base, _MACOS_LIB_EXT)
elif IS_LINUX: return "%s%s" % (base, _LINUX_LIB_EXT)
raise Exception( __NOT_SUPPORTED_MSG )
return base

def _isMacApp( path ):
if path is None : return False
Expand Down

0 comments on commit 72073fe

Please sign in to comment.