⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c8349.htm

📁 GUI Programming with Python
💻 HTM
字号:
<HTML><HEAD><TITLE>Delivering your Application</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.72"><LINKREL="HOME"TITLE="GUI Programming with Python: QT Edition"HREF="book1.htm"><LINKREL="UP"TITLE="Creating real applications with PyQt"HREF="p4627.htm"><LINKREL="PREVIOUS"TITLE="Internationalizing an Application"HREF="c8212.htm"><LINKREL="NEXT"TITLE="Packaging source"HREF="x8401.htm"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GUI Programming with Python: QT Edition</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="c8212.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x8401.htm"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CH18">Chapter 26. Delivering your Application</A></H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="c8349.htm#AEN8351">Introduction</A></DT><DT><AHREF="x8401.htm">Packaging source</A></DT><DT><AHREF="x8418.htm">Starting with distutils.</A></DT><DT><AHREF="x8580.htm">Creating Unix RPM packages</A></DT><DT><AHREF="x8613.htm">Windows installers</A></DT><DT><AHREF="x8628.htm">Desktop integration</A></DT></DL></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="AEN8351">Introduction</A></H1><P>Packaging your software for installation is      a difficult, nasty, unpleasant, arduous, error-prone task. It is      awfully enticing to just give up, zip up your Python source code      together with a README file, and leave it at that.</P><P>In some cases, doing just that might be      wise: if your intended users are technically knowledgeable, you      can ask them to install Python, edit system variables, and mess      around until everything works. Typically, though, more than this      is expected.</P><P>The first problem of packaging an      application for installation arises because of the wide variety      of platforms a PyQt application will run on: Classic Unix,      Linux, the free BSDs, Windows in its infinite variety and      finally OS X. Depending upon your target audience, one or more      of these platforms can be dropped. If your application is open      source, you might be able to get other developers to package      your application for their platform.</P><P>The second problem is that Python has      several methods of packaging applications. The standard is      <SPANCLASS="APPLICATION">Distutils</SPAN>, which comes with the      Python distribution. Then there is      <SPANCLASS="APPLICATION">freeze</SPAN>, Gordon McMillan's      <SPANCLASS="APPLICATION">Installer</SPAN>, Fredrik Lundh's      <SPANCLASS="APPLICATION">Squeeze</SPAN> (which is packaged with the      <SPANCLASS="APPLICATION">PythonWorks</SPAN> IDE), and finally Thomas      Heller's <SPANCLASS="APPLICATION">py2exe</SPAN> (which makes use of      <SPANCLASS="APPLICATION">Distutils</SPAN>). There are also generic      commercial solutions, such as <SPANCLASS="APPLICATION">Wise</SPAN> or      <SPANCLASS="APPLICATION">InstallShield</SPAN> (both for Windows) and      <SPANCLASS="APPLICATION">InstallAnywhere</SPAN> (for all platforms      that support Java). Furthermore, there are free alternatives,      such as rpm or dpgk for Unix. This breadth of choice alone      points to the fact that creating installation packages is a      difficult problem that has yet to be solved.</P><P>Distutils is the standard Python solution      and comes with Python 2.x. It appears to be more geared to      distribution modules and libraries, and less to distributing      applications. If you want something that generates stand-alone      executables of an application, you might want to try Gordon      McMillan's Installer (http://www.mcmillan-inc.com/builder.html).      BlackAdder will probably provide an installation utility in a      future version, and it will probably be based on      Distutils.</P><P>The third problem (they do mount up) is      that you cannot assume that your user has Python installed. You      must choose whether you want your users to install Python      themselves, or package a complete Python installation with your      application. The first option is perfectly feasible on Linux,      because installing Python using either rpm or apt-get is easy      enough. The second option might be feasible on Windows, as      Python for windows comes with a very nice and easy installer. Of      course, Windows users are generally a bit lazier than Unix      users, and might not want to install another package before they      can start using your application.</P><P>The fourth problem is the presence, or      absence, of PyQt. Again, most modern Linux distributions include      PyQt, so users can just grab the rpm or deb package, and go. As      for Windows, you can freely redistribute the runtime components      that come with BlackAdder, if you have bought the professional      version or the non-commercial PyQt and Qt libraries.</P><P>The fifth problem arises if you have used      third-party modules that require separate compilation for each      platform, and separate installation.</P><P>A sixth problem arises if you have written      extensions in C or C++ as part of your application or library,      and want to distribute those, too.</P><P>Finally, it's difficult to achieve even a      little integration with the user's desktop. All user interface      platforms Qt supports - Windows, KDE, Gnome, CDE, OS X and      others have wildly different standards for menu options, desktop      icons, mime-type integration (for those open file with      application menu's). This is, perhaps, the hardest, as it      requires knowledge of all relevant desktop environments.</P><P>This chapter will cover the creation of      source packages, Windows installers and Unix rpms using the      standard <SPANCLASS="APPLICATION">Distutils</SPAN> package. This      requires that the user has already installed Python, PyQt, and      any other libraries. The Redhat Package Manager (rpm) on Linux      can be told to check for these dependencies. On Windows, it's a      matter of forcing your users to read the manual. I don't      describe the process of packaging your own C or C++ extensions,      though it is possible. Consult the Distutils manual for more      information.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="c8212.htm"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.htm"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x8401.htm"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Internationalizing an Application</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="p4627.htm"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Packaging source</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -