2

I have created a simple program in python. Now I want trasform this script in an executable program ( with hidden source code if possible ) and when I click 2 times on it, the program install itself on the ubuntu ( in the /usr/lib or /usr/bin I think ) and it will create a new launcher in the Application -> Game menu.

How can I do that ?

3
  • Python scripts are already executable chmod +x is all you need. You can't conceal Python scripts. What have you tried? What problems are you having? Commented Oct 18, 2010 at 10:19
  • I want create an executable program from this python script. This executable will install the program and will create a new launcher in Application -> Game menu. How can I do that :) ? Commented Oct 18, 2010 at 10:23
  • Please don't repeat your question. I can read the words. Please explain what you cannot do. Executable is trivial. What problem are you having? What have you tried? What part of that didn't work? More importantly, what other "click 2 times on it, the program install itself" have you seen in Ubuntu? Can you give an example of an ubuntu program that does this? Commented Oct 18, 2010 at 10:59

3 Answers 3

3

Closed-source? Meh. Well, you can compile python iirc, or simply use an obscusificator. But I recommend to open-source it ;-) The stuff you can double-click are .desktop files, for samples, see find /usr | grep desktop.

Sign up to request clarification or add additional context in comments.

Comments

2

I can't help you with concealing the python source, however, the application launcher is a Desktop Entry file with a .desktop extension. Your installer would install that to the applications folder in one of the system XDG_DIRS such as /usr/share/ or /usr/local/share.

If you install your application's icon to a theme friendly location (such as /usr/local/share/icons/hicolor/<size>/apps/<your application name>.png) and install your executable to a location in PATH (often /usr/bin or /usr/local/bin) then you desktop entry file would not need absolute paths to the executable or icon.

As an example, let's take a python application called "myapp.py". Here is it's .desktop file:

[Desktop Entry]
Name=My Application
Type=Application
Exec=myapp.py
Icon=myapp

Then say the application is built with autotools (configure, make, make install) with the "default" build options in which prefix=/usr/local/share. The following files would be installed:

/usr/local/share/applications/myapp.desktop
/usr/local/share/icons/hicolor/16x16/apps/myapp.png
# same for sizes 22x22, 24x24, 32x32, 48x48, 64x64
# it's also a good idea to include a "scalable" svg icon
/usr/local/bin/myapp  
# ^ this is your python "executable"

After running update-desktop-database as root (or from your Makefile) then your application will have a launcher and a nice pretty icon.

Comments

0

use pyinstaller from pyinstaller.org

http://bytes.com/topic/python/insights/579554-simple-guide-using-pyinstaller

pyinstaller helloworld.py

creates 2 folders bin and dist

run your exec form dist folder like

./helloworld

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.