Console DEB¶
Tested on Debian 10
Start by creating a directory structure with the following empty files. I created a directory called tutorials in my home directory and created the condeb directory in there for no special reason… the directory can be created anywhere in your /home/username directory. The __init__.py is just an empty file.

Note
When naming your application first check to see if that name is in use on your PC. Open a terminal and type in the name if it says not found it’s probably safe to use that name.
Put the following in the Console DEB.desktop file
[Desktop Entry]
Version=1.0
Type=Application
Name=Console Deb
Comment=Build a Console Debian deb file
Exec=condeb
Icon=/usr/share/icons/gnome/48x48/apps/file-manager.png
Categories=Utility;
Terminal=true
StartupNotify=true
StartupWMClass=condeb
Name[en_US]=condeb
Put the following in the setup.py file
from setuptools import setup
setup(
name='condeb',
version='0.1',
description='Console Deb Example',
url='http://github.com/your_repo',
author='John Appleseed',
author_email='jappleseed@gmail.com',
license='MIT',
packages=['condeb'],
include_package_data=True,
entry_points = {'console_scripts' : ['condeb = condeb.condeb:main']},
data_files = [('share/applications/', ['Console DEB.desktop'])],
classifiers=["License :: OSI Approved :: BSD License",],
)
Note
The important thing to know is to not use find_packages as that does not work with stdeb.
The include_package_data=True is what will include any modules you have in the directory with the main python file.
The entry_points = {‘type_of_script’ : [‘name = project.file_name:function’]}
The data_files puts the desktop file in /usr/share/applications so it shows up on the menu.
Put the following in the condeb/condeb.py file
#!/usr/bin/python3
import time
import condeb.tools as tools
def main():
tools.hammer()
# pause for 5 seconds so we can see the terminal
time.sleep(5)
print('by')
time.sleep(1)
if __name__ == '__main__':
main()
Note
The important thing here is you have a main function for the entry_points to work. Also note the syntax for the local import.
Right click on the condeb/condeb.py file and in properties make it executable
Put the following in the condeb/tools.py file
def hammer():
print('hammer says bang')
You can check to see if you have the required packages with
apt-cache policy python3-setuptools
apt-cache policy python3-stdeb
You may need to install the required packages with
sudo apt install python3-setuptools
sudo apt install python3-stdeb
Open a terminal in the base directory (the one with setup.py) and execute the following command.
python3 setup.py --command-packages=stdeb.command bdist_deb
Make sure you don’t get any errors a few warnings are ok.
After running the above command the directory should look like this

You may need to install Gdebi if you have not installed it before. Check to see if it is installed with
apt-cache policy gdebi
If Gdebi is not installed you can install it with
sudo apt install gdebi
Right click on the python3-condeb_0.1-1_all.deb file and open with Gdebi. You should see the following files

On a fresh Debian 10 some dependencies may need to be installed.


Then click on Install Package.
After installing you should find the Console DEB application in the Applications/Accessories menu.

This console will pop up for 5 seconds when you click on Console DEB.
