Differences between revisions 6 and 22 (spanning 16 versions)
Revision 6 as of 2008-10-04 03:36:47
Size: 6871
Editor: cpe-72-128-41-249
Comment:
Revision 22 as of 2010-08-29 12:25:55
Size: 3702
Editor: chello212186002156
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
http://undefined.org/python/py2app.html
print "WELCOME TO SAM OS V.2 ;)"
print"============================================================="
print "by CH TECH"
print " "
py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. py2app is similar in purpose and design to py2exe for Windows.

Latest Version 0.5.3

== Installation ==

(py2app version 0.5 2010-07-28 Ronald Oussuroren)

"easy_install-X.Y -U py2app" should install the software, where X.Y is your favorite version of Python.

There is one new feature in this release: experimental support for python 3. This basicly means that I managed to build a single application as a standalone application bundle, without much testing. Alias builds and plugin bundles almost certainly don't work (the first because alias builds use the Carbon module which isn't available in python 3, the latter because I had to rewrite the C code in the application bundles and probably have to do the same for plugin bundles).

== Notes ==

Execute a bundled app from the commandline to see error messages:

  myapp.app/Contents/MacOS/myapp

== Link Collection ==

Current repository:

   * py2app: http://bitbucket.org/ronaldoussoren/py2app
   * macholib: http://bitbucket.org/ronaldoussoren/macholib
   * modulegraph: http://bitbucket.org/ronaldoussoren/modulegraph
   * altgraph: http://bitbucket.org/ronaldoussoren/altgraph

Old subversion:

   * source http://svn.pythonmac.org/py2app/py2app/trunk/
   * documentation http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

 * http://svn.pythonmac.org/py2app/py2app/trunk
 * http://svn.pythonmac.org/macholib/macholib/trunk
 * http://svn.pythonmac.org/altgraph/altgraph/trunk
 * http://svn.pythonmac.org/modulegraph/modulegraph/trunk

 checkout and install. install with "python setup.py install"
 or let easy_install do it for you.

 '''ATTENTION''' some things are in /Library/Python and some things
 in /Library/Frameworks/Python.framework/ and there is /usr/lib/python too.

Original version:

  * source http://undefined.org/python (points to repository)
  * documentation http://undefined.org/python/py2app.html (might be old)

=== Problems before 0.5 ===

 * for 64-bit systems, the pypi package (0.4.2) failed.
   even with macholib, altgraph and modulegraph gathered from all around.
 * here
 is some workaround http://hg.hardcoded.net/py2app,
   that i have not tested, as macholib is missing

=== current state 0.5.2 ===
Line 8: Line 60:
=== questions ===
Line 9: Line 62:
is it really necessary to run 'python setup.py py2app' with sudo ?
Line 10: Line 64:
sentinel=0
b=0
while sentinel!= 11235813:
    sentinel=input ('THE ? IS MIGHTIER THAN THE SWORD')
    if sentinel!=11235813:
       
        print'ACCESS DENIED'
    
        
it writes into /Library ?
Line 20: Line 66:
print "S.A.M. DATABASE ACCESSED" and there still is an error that ::
Line 22: Line 68:
print"----------------------------------------------------------"  '/Library/Python/2.6/site-packages/py2app-0.5-py2.6.egg/py2app/apptemplate/prebuilt/main-i386'
Line 24: Line 70:
print"WELCOME TO CLAYTON HENDERSON'S PERSONAL OPERATING SYSTEM" is missing. There is only ::
Line 26: Line 72:
print"---------------------------------------------------------"   main-fat3 main-intel main-universal
Line 28: Line 74:
print"HOW MAY I BE OF SERVICE ?"
print"======================================================================="
linking main-fat3 to main-i386 ::
Line 31: Line 76:
a=input("PLEASE ENTER THE CODE OF YOUR CHOICE, TYPE 1 FOR DIVISION PROBLEMS "
        "2 FOR MULTIPLUCATION,"
        "3 FOR MORE OR LESS,"
        "4 FOR GUESSING GAME "
        "5 FOR FAMILY INFO,"
        "6 FOR AREA,"
        "7 FOR VOLUME,"
        "8 FOR EXPONENTS,"
        "9 FOR AREA OF A TRIANGLE,"
        "14 FOR ALGEBRA,"
        " 15 FOR FIBBOACCI,"
        " 16 FOR FILE DATABASE,"
        " 17 FOR ADDRESS BOOK,"
        " 18 for TAKBOARD"
        "TYPE exit TO END THE PROGRAM")
print"========================================================================"
if a==1:
    a=input("ENTER DIVISIOR")
    b=input("ENTER DIVIDEND")
    print b/a
  'cd /Library/Python/2.6/site-packages/py2app-0.5-py2.6.egg/py2app/apptemplate/prebuilt'
Line 52: Line 78:
  'ln -s main-fat3 main-i386'
Line 53: Line 80:
if a==2:
    a=input("ENTER A NUMBER")
    b=input("ENTER A NUMBER")
    print a*b
makes the build succeed, when using sudo ::
Line 58: Line 82:
if a==3:
    X=input ('enter a num')
    if X<50:
        print' number is less than 50'
  sudo python setup-mac.py py2app
Line 63: Line 84:
    if X>50:
        print 'number is greater than 50'
but the app crashes ::
Line 66: Line 86:
    if X==50:
        print'The number is equal to 50'
  mine.app/Contents/MacOS/mine
Line 69: Line 88:
if a==4:
    import random
  Traceback (most recent call last):
  File "MySQLdb/__init__.pyc", line 19, in <module>
  File "_mysql.pyc", line 18, in <module>
  File "_mysql.pyc", line 15, in __load
  ImportError: '/usr/lib/python2.6/lib-dynload/_mysql.so' not found
Line 72: Line 94:
    num=random.randint(1,50) _so is in the app, but not in the system (i like to keep things local)
Line 74: Line 96:
    counter=15
    print"you have 16 guesses. My number is between 1 and 50"
    guess=input("guess a number:")
copying _mysql.so into /usr/lib/python2.6/lib-dynload, cured this.
Line 78: Line 98:
    while guess!=num and counter>0:
        if guess >num:
            print"guess is too hi"
        if guess<num:
            print "you guessed too low"
        guess=input("try again:")
        counter=counter-1
 
    if guess!=num:
        print"you loose my number was"+str (num)
Then it works.
Line 89: Line 100:
    if guess==num:
        print'YOU WIN'
== Development ==
Line 92: Line 102:
if a==5:
    sentinel=0
    while sentinel!= 2157:
        sentinel=input("ENTER FAMILY PASSWORD")
        if sentinel!=2157:
            print "FAMILY DATABASE RESTRICTED TO YOU"
    if sentinel==2157:
        print"WELCOME"
        
    
    print "DATABASE ACCESSED. ENTER FILE NAME."
=== Python Versions ===
Line 104: Line 104:
    family=["camille","nate","clayton","annette", "david"] modulegraph/util.py requires python>=2.6 for immutable bytes by 'b"something"'.
Line 106: Line 106:
    intel=[" is 8, 4th grade, plays soccer,"," is 11, 6th grade obsessive, gym & soccer", "RESTRICTED"," is approx 47,works @ grapevine designs"," is approx 43,works at Providence Med Center"] === Testing ===
Line 108: Line 108:
    name=raw_input("enter a file name for family intel:")
    x=0
    while name!=family [x]:
        x=x+1


    
    print name+intel [x]



if a==6:
    print"AREA"
    

    A=input("enter the length")
    C=input("enter the with")

    
    print A*C


    raw_input()




if a==7:
    print"VOLUME"
    

    A=input("enter the length")
    C=input("enter the with")
    B=input("enter height")

    print A*B*C
 


    raw_input()



if a==8:
    print"EXPONENTS"
    A=input("base")
    B=input("power")

    print A**B


    

    






if a==00:
    print"PLAN MODE STARTED"
    print"--------------------------------------------------"
    V1=raw_input("PLEASE ENTER THE FIRST VARIABLE IN PLAN")
    V2=raw_input("PLEASE ENTER THE SECOND VARIABLE IN PLAN")
    obj=raw_input("ENTER THE OBJECTIVE")
    obs=raw_input("ARE THERE ANY OBSTICLES")
    action=raw_input("ENTER SELECTED PLAN OF ACTION")

    print "THE VARIABLES ARE " +V1 + V2
    print "THE OBJECTIVE IS " +obj
    print" THE OBSTICLE IS " +obs
    print "OUR SELECTED PLAN OF ACTION IS " +action
if a==14:
    print"====================================================="
    print "ALGEBRA SOLVER BETA PROGRAM"
    print"---------------------------------------------------"
    V1=input("()")
    V2=input("Exponents num**num")
    V3=input("multiply x*x")
    V4=input("division x/x")
    V5=input("addition x+x")
    V6=input("subtract x-x")

    choice1=input("YOUR CHOICES ARE...1:MULTIPLY, 2 ADD, 3 SUB, 4 DIVIDE")
    choice2=input("YOUR CHOICES ARE...1:MULTIPLY, 2 ADD, 3 SUB, 4 DIVIDE")
    choice3=input("YOUR CHOICES ARE...1:MULTIPLY, 2 ADD, 3 SUB, 4 DIVIDE")
    

    




    if choice1==1:
        print V1*V2
    if choice1==2:
        print V1+V2
    if choice1==3:
        print V1-V2
    if choice1==4:
        print V1/V2

    
    if choice2==1:
        print V3*V34
    if choice2==2:
        print V3+V4
    if choice2==3:
        print V3-V4
    if choice2==4:
        print V3/V4

    
    if choice3==1:
        print V5*V6
    if choice3==2:
        print V5+V6
    if choice3==3:
        print V5-V6
    if choice3==4:
        print V5/V6

    

    

if a==9:
    a=input("height")
    b=input("base")
    print a*(b*.5)

if a==15:
    a=0
    b=1
    c=0
    d=0
    e=input("enter a number")

    while d<e:
        print a+b
        c=a
        a=b
        b=c+b

        d+=1

    raw_input()





if a ==16:
    print "FILE DATABASE SUBSYSTEM"

    
    Word=["Clayton", "SAM","Computer", "Program","Internet","Door Code", "Apple Computers",]

    Define=[" -Clayton wrote this program "," -SAM is a personal OS", "-a machine that works with a user interface","-An environment in which a computer completes a task", "-is a network of servers that a user may connect to","3502","-A computer company which makes and designs powerful processors and hardware"]
    iWord=raw_input("ENTER KEYWORD:")
    x=0
    while iWord!=Word [x]:
        x=x+1


    print"================================================"
    print iWord+Define [x]
    print"================================================"


if a==17:
    print"================================================="
    print"ADDRESS BOOK"
    print"=================================================="

    Name=["Andy","Robbie","Jackson"]
    Phone=["962-1568","962-5710","268-3787"]
    a=input("ENTER NAME")


    b=0
    while a!=Name [b]:
        b=b+1

    print"==================================================="
    print a+Phone[b]
    print"==================================================="

if a==18:
    print "TAK-BOARD"
    print" "
    a=input("ENTER TIME DO NOT USE A :")
    b=input("ENTER PLACE")
    c=input("ENTER EVENT")

    print"----------------------------------------------"
    print a + b + c

    

raw_input("PROGRAM HAS CEASED, RESTART TO CONTINUE THANK YOU FOR USING SAM OS V")
py.test is used for testing. modulegraph/util.py contains tests in util.py.
maybe revert to unittest.

py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. py2app is similar in purpose and design to py2exe for Windows.

Latest Version 0.5.3

Installation

(py2app version 0.5 2010-07-28 Ronald Oussuroren)

"easy_install-X.Y -U py2app" should install the software, where X.Y is your favorite version of Python.

There is one new feature in this release: experimental support for python 3. This basicly means that I managed to build a single application as a standalone application bundle, without much testing. Alias builds and plugin bundles almost certainly don't work (the first because alias builds use the Carbon module which isn't available in python 3, the latter because I had to rewrite the C code in the application bundles and probably have to do the same for plugin bundles).

Notes

Execute a bundled app from the commandline to see error messages:

  • myapp.app/Contents/MacOS/myapp

Current repository:

Old subversion:

Original version:

Problems before 0.5

  • for 64-bit systems, the pypi package (0.4.2) failed.
    • even with macholib, altgraph and modulegraph gathered from all around.
  • here

    is some workaround http://hg.hardcoded.net/py2app,

    • that i have not tested, as macholib is missing

current state 0.5.2

questions

is it really necessary to run 'python setup.py py2app' with sudo ?

it writes into /Library ?

and there still is an error that ::

  • '/Library/Python/2.6/site-packages/py2app-0.5-py2.6.egg/py2app/apptemplate/prebuilt/main-i386'

is missing. There is only ::

  • main-fat3 main-intel main-universal

linking main-fat3 to main-i386 ::

  • 'cd /Library/Python/2.6/site-packages/py2app-0.5-py2.6.egg/py2app/apptemplate/prebuilt' 'ln -s main-fat3 main-i386'

makes the build succeed, when using sudo ::

  • sudo python setup-mac.py py2app

but the app crashes ::

  • mine.app/Contents/MacOS/mine Traceback (most recent call last):

    File "MySQLdb/init.pyc", line 19, in <module> File "_mysql.pyc", line 18, in <module> File "_mysql.pyc", line 15, in load ImportError: '/usr/lib/python2.6/lib-dynload/_mysql.so' not found

_so is in the app, but not in the system (i like to keep things local)

copying _mysql.so into /usr/lib/python2.6/lib-dynload, cured this.

Then it works.

Development

Python Versions

modulegraph/util.py requires python>=2.6 for immutable bytes by 'b"something"'.

Testing

py.test is used for testing. modulegraph/util.py contains tests in util.py. maybe revert to unittest.

MacPython/py2app (last edited 2010-08-29 12:25:55 by chello212186002156)

Unable to edit the page? See the FrontPage for instructions.