Creating Windows Start Menu or Desktop shortcuts using setuptools bdist_winst installer
Yaşar Arabacı
yasar11732 at gmail.com
Sat Jul 19 10:23:10 EDT 2014
This is a cross-post from stackoverflow:
http://stackoverflow.com/q/24841130/886669
I am not sure about cross-posting policies of python-list. I am sorry
if this is discouraged.
Here is my problem;
I want to create a start menu or Desktop shortcut for my Python
windows installer package. I am trying to follow
https://docs.python.org/3.4/distutils/builtdist.html#the-postinstallation-script
Here is my script;
import sys
from os.path import dirname, join, expanduser
pyw_executable = sys.executable.replace('python.exe','pythonw.exe')
script_file = join(dirname(pyw_executable), 'Scripts', 'tklsystem-script.py')
w_dir = expanduser(join('~','lsf_files'))
print(sys.argv)
if sys.argv[1] == '-install':
print('Creating Shortcut')
create_shortcut(
target=pyw_executable,
description='A program to work with L-System Equations',
filename='L-System Tool',
arguments=script_file,
workdir=wdir
)
I also specified this script in scripts setup option, as indicated by
aforementioned docs.
Here is the command I use to create my installer;
python setup.py bdist_wininst --install-script tklsystem-post-install.py
After I install my package using created windows installer, I can't
find where my shorcut is created, nor I can confirm whether my script
run or not.
How can I make setuptools generated windows installer to create
desktop or start menu shortcuts?
--
http://ysar.net/
More information about the Python-list
mailing list