How do I compile apps with Python?

discuss compiling applications for Puppy
Post Reply
Message
Author
User avatar
Tman
Posts: 808
Joined: Sat 22 Jan 2011, 21:39
Location: Toronto

How do I compile apps with Python?

#1 Post by Tman »

These, days when I play with Puppy stuff, I am trying to compile different apps. Having learned the basics of how to use GCC compiler, I thought I'd try to learn how to compile Python apps.

Can anyone please tell me what the basic steps to compiling Python apps are?

More specifically, what is the Python equivalent to the following code?

Code: Select all

./configure  --prefix=/usr  ...etc
make install
make install DESTDIR=/my/custom/folder
So far, I've only discovered the following:

Code: Select all

python setup.py --fcompiler=gnu build
python setup.py install
I not 100% sure if the code above is correct. (input needed)
What code do I need to install the app to a custom folder, so that I can use dir2pet on it?

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#2 Post by tallboy »

Python is an high-level, interpreted languge, so no compilation is necessary.
http://docs.python.org/tutorial/index.html

tallboy

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#3 Post by muggins »

Python apps will often come with setup.py

Code: Select all

 ./setup.py
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied
# ./setup.py --help
Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)      run verbosely (default)
  --quiet (-q)        run quietly (turns verbosity off)
  --dry-run (-n)      don't actually do anything
  --help (-h)         show detailed help message
  --command-packages  list of packages that provide distutils commands

Information display options (just display information, ignore any commands)
  --help-commands     list all available commands
  --name              print package name
  --version (-V)      print package version
  --fullname          print <package name>-<version>
  --author            print the author's name
  --author-email      print the author's email address
  --maintainer        print the maintainer's name
  --maintainer-email  print the maintainer's email address
  --contact           print the maintainer's name if known, else the author's
  --contact-email     print the maintainer's email address if known, else the
                      author's
  --url               print the URL for this package
  --license           print the license of the package
  --licence           alias for --license
  --description       print the package description
  --long-description  print the long package description
  --platforms         print the list of platforms
  --classifiers       print the list of classifiers
  --keywords          print the list of keywords
  --provides          print the list of packages/modules provided
  --requires          print the list of packages/modules required
  --obsoletes         print the list of packages/modules made obsolete

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help
Problems arise when the python you've installed is missing certain modules the particular app needs etc.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#4 Post by disciple »

You might also come across "Python eggs" which require "EasyInstall"
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Tman
Posts: 808
Joined: Sat 22 Jan 2011, 21:39
Location: Toronto

#5 Post by Tman »

Thank you tallboy, muggins and disciple for the info. It is much appreciated. I didn't know python programs don't need to be compiled. So I guess, they are kind-of like bash scripts then?

So I assume that when I use setup.py, I will just look for a "build" folder and use dir2pet on it, after I have renamed it.

I did come across http://cx-freeze.sourceforge.net/ which looks interesting...
It is supposed to turn Python apps into binaries. I haven't tried it out yet, though.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#6 Post by disciple »

So I guess, they are kind-of like bash scripts then?
Yes, they are Python scripts.
As you might have noticed in Muggins post, you don't need to run `python some_script.py`. You can just run `path_to_some_script.py`, and it will run, as long as it is executable.

But some programs that are mainly Python might have parts written in another language like C, to get better performance than Python can provide. In that case the C parts would obviously be compiled. Also, Python programs often have dependencies which are Python bindings of C libraries. These are also compiled IIRC.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Post Reply