Skip to content

Commit

Permalink
Changed the install script to use the full python path, not rely on t…
Browse files Browse the repository at this point in the history
…he PATH being set properly.
  • Loading branch information
esitarski committed Jul 30, 2024
1 parent acb2ca0 commit 54ff2b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
5 changes: 0 additions & 5 deletions SeriesMgr/Errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def shorterFilename( fileName ):
return os.path.join( *components[-3:] )

class Errors(wx.Panel):
#----------------------------------------------------------------------
ErrorCol = 0
RaceCol = 1

Expand Down Expand Up @@ -56,16 +55,12 @@ def refresh( self ):
def commit( self ):
pass

#----------------------------------------------------------------------------

class ErrorsFrame(wx.Frame):
#----------------------------------------------------------------------
def __init__(self):
wx.Frame.__init__(self, None, title="Error Test", size=(800,600) )
self.panel = Errors(self)
self.Show()

#----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.App(False)
frame = ErrorsFrame()
Expand Down
2 changes: 1 addition & 1 deletion SeriesMgr/FieldMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def summary( self ):
"UCI ID of the form NNNNNNNNNNN",
),
('bib',
('Bib','BibNum','Bib Num', 'Bib #', 'Bib#', 'Rider Bib #','Plate', 'Plate #', 'Plate#','Numéro','plaque'),
('Bib','BibNum','Bib Num', 'Bib #', 'Bib#', 'Rider Bib #', 'Rider #', 'Rider#', 'Plate', 'Plate #', 'Plate#','Numéro','plaque'),
"Bib number",
),
('paid',
Expand Down
26 changes: 14 additions & 12 deletions crossmgr-install.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def env_setup( full=False ):

if not os.path.isdir( env_dir ):
print( f"Creating python environment in {os.path.abspath(os.path.join('.',env_dir))}... ", end='', flush=True )
subprocess.check_output( ['python3', '-m', 'venv', env_dir] )
subprocess.check_output( [sys.executable, '-m', 'venv', env_dir] ) # Call this with the script's python as we don't have an environment yet.
print( 'Done.' )

# Get the path to the exe.
Expand Down Expand Up @@ -329,26 +329,28 @@ def get_ico_file( pyw_file ):
shortcuts_fname = 'make_shortcuts_tmp.py'

script_info=tuple( (pyw, get_ico_file(pyw), get_name(pyw)) for pyw in pyws )
contents = '\n'.join( [
'from pyshortcuts import make_shortcut',
"for script, ico, name in {script_info}:",
" make_shortcut( terminal=False, startmenu=False, executable='{python_exe}', script=script, icon=ico, name=name )",
] ).format( python_exe=python_exe, script_info=script_info )

with open(shortcuts_fname, 'w', encoding='utf8') as f:
f.write( '\n'.join( [
'from pyshortcuts import make_shortcut',
"for script, ico, name in {script_info}:",
" make_shortcut( terminal=False, startmenu=False, executable='{python_exe}', icon=ico, script=script, name=name )",
] ).format( python_exe=python_exe, script_info=script_info )
)
f.write( contents )

subprocess.check_output( [python_exe, shortcuts_fname] )
os.remove( shortcuts_fname )

# Create a shortcut for this update script.
# Remember, we are in the CrossMgr-master directory.
icon = os.path.abspath( os.path.join('.', 'CrossMgrImages', 'CrossMgrDownload.png') )
contents = '\n'.join( [
'from pyshortcuts import make_shortcut',
f"make_shortcut( terminal=True, startmenu=False, executable='{python_exe}', script='{__file__} install', icon='{icon}', name='Update CrossMgr' )",
] )

with open(shortcuts_fname, 'w', encoding='utf8') as f:
f.write( '\n'.join( [
'from pyshortcuts import make_shortcut',
f"make_shortcut( terminal=True, startmenu=False, executable='python3', icon='{icon}', script='{__file__} install', name='Update CrossMgr' )",
] ).format( python_exe=python_exe, script_info=script_info )
)
f.write( contents )

subprocess.check_output( [python_exe, shortcuts_fname] )
os.remove( shortcuts_fname )
Expand Down

0 comments on commit 54ff2b1

Please sign in to comment.