| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="dist.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="dist.html" title='Distributing Python Modules' /> |
| 8 | <link rel='index' href='genindex.html' title='Index' /> |
| 9 | <link rel='last' href='about.html' title='About this document...' /> |
| 10 | <link rel='help' href='about.html' title='About this document...' /> |
| 11 | <link rel="next" href="meta-data.html" /> |
| 12 | <link rel="prev" href="node11.html" /> |
| 13 | <link rel="parent" href="setup-script.html" /> |
| 14 | <link rel="next" href="meta-data.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>2.6 Installing Additional Files</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="2.5 Installing Package Data" |
| 24 | href="node11.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="2. Writing the Setup" |
| 27 | href="setup-script.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="2.7 Additional meta-data" |
| 30 | href="meta-data.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Distributing Python Modules</td> |
| 33 | <td class='online-navigation'><img src='../icons/blank.png' |
| 34 | border='0' height='32' alt='' width='32' /></td> |
| 35 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 36 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 37 | <td class='online-navigation'><a rel="index" title="Index" |
| 38 | href="genindex.html"><img src='../icons/index.png' |
| 39 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 40 | </tr></table> |
| 41 | <div class='online-navigation'> |
| 42 | <b class="navlabel">Previous:</b> |
| 43 | <a class="sectref" rel="prev" href="node11.html">2.5 Installing Package Data</A> |
| 44 | <b class="navlabel">Up:</b> |
| 45 | <a class="sectref" rel="parent" href="setup-script.html">2. Writing the Setup</A> |
| 46 | <b class="navlabel">Next:</b> |
| 47 | <a class="sectref" rel="next" href="meta-data.html">2.7 Additional meta-data</A> |
| 48 | </div> |
| 49 | <hr /></div> |
| 50 | </DIV> |
| 51 | <!--End of Navigation Panel--> |
| 52 | |
| 53 | <H1><A NAME="SECTION002600000000000000000"> |
| 54 | 2.6 Installing Additional Files</A> |
| 55 | </H1> |
| 56 | |
| 57 | <P> |
| 58 | The <span class="du-option">data_files</span> option can be used to specify additional |
| 59 | files needed by the module distribution: configuration files, message |
| 60 | catalogs, data files, anything which doesn't fit in the previous |
| 61 | categories. |
| 62 | |
| 63 | <P> |
| 64 | <span class="du-option">data_files</span> specifies a sequence of (<var>directory</var>, |
| 65 | <var>files</var>) pairs in the following way: |
| 66 | |
| 67 | <P> |
| 68 | <div class="verbatim"><pre> |
| 69 | setup(... |
| 70 | data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']), |
| 71 | ('config', ['cfg/data.cfg']), |
| 72 | ('/etc/init.d', ['init-script'])] |
| 73 | ) |
| 74 | </pre></div> |
| 75 | |
| 76 | <P> |
| 77 | Note that you can specify the directory names where the data files |
| 78 | will be installed, but you cannot rename the data files themselves. |
| 79 | |
| 80 | <P> |
| 81 | Each (<var>directory</var>, <var>files</var>) pair in the sequence specifies the |
| 82 | installation directory and the files to install there. If |
| 83 | <var>directory</var> is a relative path, it is interpreted relative to the |
| 84 | installation prefix (Python's <code>sys.prefix</code> for pure-Python |
| 85 | packages, <code>sys.exec_prefix</code> for packages that contain extension |
| 86 | modules). Each file name in <var>files</var> is interpreted relative to |
| 87 | the <span class="file">setup.py</span> script at the top of the package source |
| 88 | distribution. No directory information from <var>files</var> is used to |
| 89 | determine the final location of the installed file; only the name of |
| 90 | the file is used. |
| 91 | |
| 92 | <P> |
| 93 | You can specify the <span class="du-option">data_files</span> options as a simple sequence |
| 94 | of files without specifying a target directory, but this is not recommended, |
| 95 | and the <code class="du-command">install</code> command will print a warning in this case. |
| 96 | To install data files directly in the target directory, an empty |
| 97 | string should be given as the directory. |
| 98 | |
| 99 | <P> |
| 100 | |
| 101 | <DIV CLASS="navigation"> |
| 102 | <div class='online-navigation'> |
| 103 | <p></p><hr /> |
| 104 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 105 | <tr> |
| 106 | <td class='online-navigation'><a rel="prev" title="2.5 Installing Package Data" |
| 107 | href="node11.html"><img src='../icons/previous.png' |
| 108 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 109 | <td class='online-navigation'><a rel="parent" title="2. Writing the Setup" |
| 110 | href="setup-script.html"><img src='../icons/up.png' |
| 111 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 112 | <td class='online-navigation'><a rel="next" title="2.7 Additional meta-data" |
| 113 | href="meta-data.html"><img src='../icons/next.png' |
| 114 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 115 | <td align="center" width="100%">Distributing Python Modules</td> |
| 116 | <td class='online-navigation'><img src='../icons/blank.png' |
| 117 | border='0' height='32' alt='' width='32' /></td> |
| 118 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 119 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 120 | <td class='online-navigation'><a rel="index" title="Index" |
| 121 | href="genindex.html"><img src='../icons/index.png' |
| 122 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 123 | </tr></table> |
| 124 | <div class='online-navigation'> |
| 125 | <b class="navlabel">Previous:</b> |
| 126 | <a class="sectref" rel="prev" href="node11.html">2.5 Installing Package Data</A> |
| 127 | <b class="navlabel">Up:</b> |
| 128 | <a class="sectref" rel="parent" href="setup-script.html">2. Writing the Setup</A> |
| 129 | <b class="navlabel">Next:</b> |
| 130 | <a class="sectref" rel="next" href="meta-data.html">2.7 Additional meta-data</A> |
| 131 | </div> |
| 132 | </div> |
| 133 | <hr /> |
| 134 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 135 | </DIV> |
| 136 | <!--End of Navigation Panel--> |
| 137 | <ADDRESS> |
| 138 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 139 | </ADDRESS> |
| 140 | </BODY> |
| 141 | </HTML> |