我在文件夹startup.sh
中有2个脚本:desktopsetup.sh
和bin
。以下是我setup.py
的代码。
from setuptools import setup
from setuptools.command.install import install
import os
class MyInstall(install):
def run(self):
install.run(self)
path = os.getcwd().replace(" ", "\ ").replace("(","\(").replace(")","\)") + "/bin/"
os.system("echo 'Setting up Tzara.desktop'")
os.system("chmod +x "+path+"desktopsetup.sh")
os.system("sh "+path+"desktopsetup.sh")
os.system("chmod +x "+path+"startup.sh")
os.system("sh "+path+"startup.sh")
setup(name='Tzara---A-Personal-Assistant',
version='1.0.6',
description='A Virtual Personal Assistant',
url='https://github.com/Suman7495/Tzara---A-Personal-Assistant',
author='MyName',
author_email='myemail@gmail.com',
license='MIT',
packages=['tzara'],
classifiers=['Development Status :: 4 - Beta',
'Programming Language :: Python :: 2.7',
],
scripts=['bin/desktopsetup.sh', 'bin/startup.sh'],
cmdclass={'install': MyInstall},
)
当我使用python install setup.py
运行时,只运行startup.sh
,desktopsetup.sh
无法运行。
这是我的desktopsetup.sh
代码:
#!/bin/bash
STR=$'[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Tzara
Comment=A Virtual Personal Assistant
Exec=guake -n guake -t -e "python /usr/local/lib/python2.7/dist-packages/tzara/main.pyc" guake -r "Tzara"
Terminal=True
Type=Application
Categories=Application'
if [ ! -e /usr/share/applications/Tzara.desktop ]; then
echo "Setting up .desktop file"
echo "$STR" | sudo tee sudo /usr/share/applications/Tzara.desktop > /dev/null
read -n1 -r -p "Press any key to continue..." key
fi
找到the details of my code here.
如果有人能提供一点帮助,我会非常感激。