<p>假设我有<code>my_application.py.in</code>供automake生成<code>my_application.py</code>。如何在扩展${prefix}的情况下将datadir放入我的应用程序?现在我能想到的最好方法是在python应用程序中使用<code>replace()</code>,但是,我假设有一种更合适的方法。在</p>
<pre><code>if __name__ == "__main__":
app = Application()
app.VERSION = '@VERSION@'
app.PACKAGE = '@PACKAGE@'
# How should I get the DATA_DIR in this next line?
app.DATA_DIR = "@datarootdir@".replace("${prefix}", "@prefix@")
app.run()
</code></pre>