473,803 Members | 3,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wrapping Python ?

Does Python have facilities for wrapping up the interpreter, any necessary
modules, GUI library, python scripts, image files, etc. up into a single
executable like exists for Tcl/Tk?
e.g. http://freewrap.sourceforge.net/
http://www.equi4.com/starkit.html

I've seen py2exe but it's not quite the same thing and doesn't appear to be
as comprehensive as the above 2 are for Tcl/Tk.

Thanks!
Jul 18 '05 #1
6 2428
USCode wrote:
Does Python have facilities for wrapping up the interpreter, any necessary
modules, GUI library, python scripts, image files, etc. up into a single
executable like exists for Tcl/Tk?
e.g. http://freewrap.sourceforge.net/
http://www.equi4.com/starkit.html

I've seen py2exe but it's not quite the same thing and doesn't appear to be
as comprehensive as the above 2 are for Tcl/Tk.


In what way is it not the same thing? (Hint: I'm not about to
follow those links and learn about the products just to answer
the question... maybe you could explain it, since you seem to
be the one who knows about all three products.)

Also could you explain in what way you feel py2exe is not as
"comprehensive" ? It does what it does, does it well, and
doesn't really seem to be missing much in that area. Maybe
you are looking for an "installer" as well, such as InnoSetup?

-Peter
Jul 18 '05 #2
"Peter Hansen" <pe***@engcorp. com> wrote in

In what way is it not the same thing? (Hint: I'm not about to
follow those links and learn about the products just to answer
the question... maybe you could explain it, since you seem to
be the one who knows about all three products.)

Also could you explain in what way you feel py2exe is not as
"comprehensive" ? It does what it does, does it well, and
doesn't really seem to be missing much in that area. Maybe
you are looking for an "installer" as well, such as InnoSetup?

-Peter


I think the key difference is that they support the concept of a virtual
file system within the executable whereas, if I understand correctly, the
executable created by py2exe writes attached modules to the local disk in
specific directories before executing.

With Freewrap, it uses the Zip Virtual File System so as the attached ZIP
archive can be opened so its contents look like a simple file subdirectory.
From the Starkit website - "A Starkit creates the illusion of a "file system
in a file" - on the outside, it's a single file, yet the application code
continues to see a complete directory of scripts, extensions, packages,
images, and whatever other files it needs."

Also, another key difference is both the Tcl/Tk wrapping utilities are
cross-platform with both of them working on Windows and Linux. Starkit
works on OSX and lots of other platforms as well.

I'd like to generate a single executable without needing an installer or
files needing to be written out to the local disk before execution, etc.

Sorry if I'm wrong regarding the capabilities of py2exe. Otherwise perhaps
it could be enhanced someday to utilize a VFS as well.

Thanks!
Jul 18 '05 #3
USCode wrote:
subdirectory. From the Starkit website - "A Starkit creates the
illusion of a "file system in a file" - on the outside, it's a single
file, yet the application code continues to see a complete directory
of scripts, extensions, packages, images, and whatever other files it
needs."


So what is done about shared libraries? Python includes a number of
shared libraries (dll/so), several of which can end up being needed, even
by relatively simple apps. On Windows, the Python interpretter itself
is a shared library (python23.dll). For a more non-trivial app such
as my BitPim program, there are 45 libraries that end up needing to be
packaged. (A lot of this is because it is common practise to split
larger packages such as wxPython and win32all into numerous independent
sub-libraries).

py2exe and tools like that (eg cx-Freeze) do package everything into
one file, except the shared libraries are left as seperate files,
and user files are as well (since you have to have seperate files
anyway for the libraries).

The problem with shared libraries is that they have to be seperate
files for the OS to load them properly. One variant of the McMillan
installer effectively extracted them at run time, but that introduces
a whole host of problems such as the user needing write permission to
the filesystem, security (eg a shared /tmp), and that the libraries
may not end up being shared between processes (due to being extracted
to different locations for security reasons).

I tried the demo (Fractal Mountains) and can't see how it deals with
the shared library issue.

Roger

Jul 18 '05 #4
In article <ol************ @home.rogerbinn s.com>,
Roger Binns <ro****@rogerbi nns.com> wrote:
USCode wrote:
subdirectory. From the Starkit website - "A Starkit creates the
illusion of a "file system in a file" - on the outside, it's a single
file, yet the application code continues to see a complete directory
of scripts, extensions, packages, images, and whatever other files it
needs."


So what is done about shared libraries? Python includes a number of
shared libraries (dll/so), several of which can end up being needed, even
by relatively simple apps. On Windows, the Python interpretter itself
is a shared library (python23.dll). For a more non-trivial app such
as my BitPim program, there are 45 libraries that end up needing to be
packaged. (A lot of this is because it is common practise to split
larger packages such as wxPython and win32all into numerous independent
sub-libraries).

py2exe and tools like that (eg cx-Freeze) do package everything into
one file, except the shared libraries are left as seperate files,
and user files are as well (since you have to have seperate files
anyway for the libraries).

The problem with shared libraries is that they have to be seperate
files for the OS to load them properly. One variant of the McMillan
installer effectively extracted them at run time, but that introduces
a whole host of problems such as the user needing write permission to
the filesystem, security (eg a shared /tmp), and that the libraries
may not end up being shared between processes (due to being extracted
to different locations for security reasons).

I tried the demo (Fractal Mountains) and can't see how it deals with
the shared library issue.

Jul 18 '05 #5
Cameron Laird wrote:
Exactly: taking care of shared libraries as you describe (I *think*
Starkits currently assume responsibility for writing 'em into the
real file system, and loading from there) (and, yes, I know that
has security consequences) is one of Starkit's benefits. Peter, it
really is neat beyond belief.


It may be neat, but it doesn't even seem to match the OP's own
requirements, which include this statement: "a single executable without
.... files needing to be written out to the local disk before execution"

If, on the other hand, one permits that behaviour, then I doubt
that a py2exe + UPX (or whatever that beast is called) solution
would be about the same, if not arriving with such a killer name. :-)

-Peter
Jul 18 '05 #6
Cameron Laird wrote:
Exactly: taking care of shared libraries as you describe (I *think*
Starkits currently assume responsibility for writing 'em into the
real file system, and loading from there) (and, yes, I know that
has security consequences) is one of Starkit's benefits.


In that case McMillan installer will do the same thing. There is
absolutely no way I would distribute software that extracted
libraries to bits of the filesystem every time it runs on any
platform. However others have no such qualms :-)

I did some more digging on StarKit and it looks like they build
the main executable statically linked with the most common libraries
(eg Tk). Then they require that every extension library is built
using Stubs (http://mini.net/tcl/stubs) and use a builtin mechanism
for dynamically loading the extension. That still doesn't solve
the issue for OS level linking (eg when using wxPython on Linux,
there is linkage between the wxPython library into the wxWidgets
library into GTK into X). Typically the wxPython and wxWidgets
libraries are included with the application, and it wouldn't
be feasible to use something like Stubs with the wxWidgets
library, especially since it isn't directly tied to a scripting
language and exports a huge number of functions and C++ classes.

Other than extracting libraries at runtime into the real filesystem
I can only see this to be doable by re-implementing the
operating system dynamic loader.

Roger
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1340
by: Terry Hancock | last post by:
Hi all, Suppose you have found a really nice module that does what you want (or will do, it still being in development), and you don't want to waste a lot of duplicated effort, but this module is in Perl rather than Python (and yes, the author is not open to conversion -- already tried that ;-) ). If it were written in C, I'd have a couple of answers, such
13
3865
by: Roy Smith | last post by:
I've got a C library with about 50 calls in it that I want to wrap in Python. I know I could use some tool like SWIG, but that will give me a too-literal translation; I want to make some modifications along the way to make the interface more Pythonic. For example, all of these functions return an error code (typically just errno passed along, but not always). They all accept as one of their arguments a pointer to someplace to store...
6
1864
by: Andrew Wilkinson | last post by:
Hi, I'm trying to wrap a C++ class hierarchy with Python types and I'd like to maintain the hierarchy in the types. I'm fairly sure this is possible, isn't it? Are there any documents explaining how to do this, the standard Python manual doesn't go into enough detail about creating types for this. I've found the tp_base and tp_bases elements and I've set them to the base
4
1804
by: Lawrence Oluyede | last post by:
I've never used metaclasses in real life before and while searching through the online Cookbook I found this gorgeous example: "Wrapping method calls (meta-class example)" http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/198078 What I want to do in my app is to log all method calls and seems that the metaclass example above do this fine but it fails when it's needed to instantiate the class I'm in in a method. So if I do:
3
2888
by: gabriel.becedillas | last post by:
Hi, I'm having problems wrapping a hierarchy of classes, actually having problems wrapping the base class. I don't need to use the WrapClass mechanism since I don't want to override classes in Python. My code boils down to: class Base { public: virtual ~Base()
3
5615
by: Paul Anton Letnes | last post by:
Hello guys, (related to previous thread on wrapping C/C++ in Python, trying the SWIG approach.) Trying to map a C++ class to python, one method for now. Running the following commands to "compile": -------------------------------------- #!/usr/bin/env bash
8
2290
by: Anish Chapagain | last post by:
Hi!! I tried wrapping a simple C code suing SWIG to Python, but am having problem, my .c file is, Step 1: example.c -------------- double val=3.0; int fact(int n)
2
1261
by: Anish Chapagain | last post by:
Hi!! I'm new to python and have a task for Wrapping up an old program written in C(20.c files), to provide GUI and chart,graph feature in Python. I've tried using SWIG but am not getting well in windows system, wish to receive guidelines for initiating the task...
5
4312
by: Charlie | last post by:
Hi All, I am new to using swig/C++/python. I got some problem with function pointers. I posted in swig-user, but got no response. So I forwarded it here. You help is greatly appreciated. Thanks! ---------- Forwarded message ----------
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.