Skip to content

Commit

Permalink
Added PyInstallerConfig attributes distResources and distDirs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Baker authored and BuvinJ committed Jan 17, 2019
1 parent b427ac3 commit b1943d0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion distbuilder/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0.0"
__version__ = "0.3.1.0"
6 changes: 3 additions & 3 deletions distbuilder/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__( self ) :
self.entryPointPy = None
self.iconFilePath = None
self.version = (0,0,0,0)

self.setupName = DEFAULT_SETUP_NAME
self.ifwDefDirPath = None
self.pkgSrcDirPath = None
Expand Down Expand Up @@ -128,7 +128,7 @@ def __init__( self, configFactory,
self.name = name
self.configFactory = configFactory
self.isObfuscating = isObfuscating
self.isDesktopTarget = isDesktopTarget
self.isDesktopTarget = isDesktopTarget
self.isTestingObfuscation = False
self.isTestingExe = False
self.exeTestArgs = []
Expand Down Expand Up @@ -173,7 +173,7 @@ def run( self ):
pyInstConfig = self.configFactory.pyInstallerConfig()
self.onPyInstConfig( pyInstConfig )
_, binPath = buildExecutable( pyInstConfig=pyInstConfig,
opyConfig=opyConfig )
opyConfig=opyConfig )
if self.isTestingExe :
run( binPath, self.exeTestArgs,
isElevated=self.isElevatedTest, isDebug=True )
Expand Down
30 changes: 20 additions & 10 deletions distbuilder/py_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def __init__( self ) :

self.isGui = False
self.iconFilePath = None
self._pngIconResPath = None

self.versionInfo = None
self.versionFilePath = None # TODO: offer programmatic version info
Expand All @@ -62,6 +61,11 @@ def __init__( self ) :

self.isAutoElevated = False
self.otherPyInstArgs = "" # open ended

# Not directly fed into the utility. Employed by buildExecutable function.
self._pngIconResPath = None
self.distResources = []
self.distDirs = []

def __str__( self ):
nameSpec = ( "--name %s" % (self.name,)
Expand Down Expand Up @@ -207,16 +211,22 @@ def buildExecutable( name=None, entryPointPy=None,
distResources=[], distDirs=[] ):
''' returns: (binDir, binPath) '''

# Ensure pyInstConfig, name & entryPointPy
# are defined an in sync
# Resolve PyInstallerConfig and the overlapping parameters passed directly
# (PyInstallerConfig values are given priority)
if pyInstConfig is None:
pyInstConfig=PyInstallerConfig()
pyInstConfig.name = name
pyInstConfig.entryPointPy = entryPointPy
pyInstConfig = PyInstallerConfig()
pyInstConfig.name = name
pyInstConfig.entryPointPy = entryPointPy
pyInstConfig.distResources = distResources
pyInstConfig.distDirs = distDirs
else :
name = pyInstConfig.name
entryPointPy = pyInstConfig.entryPointPy
if not name : raise Exception( "Binary name is required" )
name = pyInstConfig.name
entryPointPy = pyInstConfig.entryPointPy
distResources = pyInstConfig.distResources
distDirs = pyInstConfig.distDirs

# Verify the required parameters are present
if not name : raise Exception( "Binary name is required" )
if not entryPointPy : raise Exception( "Binary entry point is required" )

# auto assign some pyInstConfig values
Expand Down Expand Up @@ -246,7 +256,7 @@ def buildExecutable( name=None, entryPointPy=None,
# Discard all temp files (but not distDir!)
__clean( pyInstConfig )

# automatically add a png icon for Linux to the
# On Linux, automatically add a png icon to the
# external resources, if one exists and is not already included
if IS_LINUX :
try:
Expand Down
6 changes: 5 additions & 1 deletion docs/Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ Attributes & default values:
isGui = False
iconFilePath = None
_pngIconResPath = None
versionInfo = None
versionFilePath = None
Expand All @@ -645,6 +644,11 @@ Attributes & default values:
isAutoElevated = False
otherPyInstArgs = "" (open ended argument string)

(Not directly fed into the utility. Employed by buildExecutable function.)
_pngIconResPath = None
distResources = []
distDirs = []

### WindowsExeVersionInfo

Objects of this type define metadata branded into Windows
Expand Down
3 changes: 2 additions & 1 deletion examples/hello_world_tk/hello.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from sys import stdout
# import Tkinter in a cross Python version manner

# cross environment Tkinter import
try: from tkinter import Tk
except: from Tkinter import Tk
try: from tkinter.ttk import Button
Expand Down

0 comments on commit b1943d0

Please sign in to comment.