Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 29 Dec 2014, 05:34
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Compiling
How do I compile apps with Python?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
Tman


Joined: 22 Jan 2011
Posts: 814
Location: Toronto

PostPosted: Sat 23 Jun 2012, 23:05    Post subject:  How do I compile apps with Python?
Subject description: .
 

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:

./configure  --prefix=/usr  ...etc
make install
make install DESTDIR=/my/custom/folder


So far, I've only discovered the following:
Code:

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?
Back to top
View user's profile Send private message 
tallboy


Joined: 21 Sep 2010
Posts: 454
Location: Oslo, Norway

PostPosted: Sun 24 Jun 2012, 07:37    Post subject:  

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

tallboy
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6690
Location: lisbon

PostPosted: Sun 24 Jun 2012, 08:58    Post subject:  

Python apps will often come with setup.py

Code:
 ./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.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6464
Location: Auckland, New Zealand

PostPosted: Sun 24 Jun 2012, 16:29    Post subject:  

You might also come across "Python eggs" which require "EasyInstall"
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
Tman


Joined: 22 Jan 2011
Posts: 814
Location: Toronto

PostPosted: Sun 24 Jun 2012, 22:41    Post subject:  

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.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6464
Location: Auckland, New Zealand

PostPosted: Sun 24 Jun 2012, 23:26    Post subject:  

Quote:
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.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Compiling
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0618s ][ Queries: 12 (0.0032s) ][ GZIP on ]