Упаковочные ресурсы с setuptools/distribute

Мои начальные мысли о WCF были точно тем же! Вот некоторые решения:

  1. Программируют Ваши собственные дженерики использования слоя прокси/клиента (см. классы ClientBase, Связывая). Я нашел это легким получить работу, но трудно к идеальному.
  2. Использование сторонняя реализация 1 ( SoftwareIsHardwork является моим текущим фаворитом)

10
задан 13 November 2009 в 23:49
поделиться

1 ответ

Have you looked at the setuptools documentation for including package data here: http://peak.telecommunity.com/DevCenter/setuptools#including-data-files

Basically, you just need to set include_package_data=True in your setup.py file. If you are using subversion or CVS, all versioned files will be included. If not, you can specify which files to include with a MANIFEST.in file.

I believe distribute supports this as well.

You can then access the files as you would without them being packaged. i.e. in main.py you could have:

import os.path
f = open(os.path.join(os.path.dirname(__file__),'templates','file1.txt'))
print f.read()
f.close()

and this would work in the packaged version as well. One caveat is that you will have to also set zip_safe = False in setup.py so that all the files are unzipped during installation.

4
ответ дан 4 December 2019 в 04:01
поделиться
Другие вопросы по тегам:

Похожие вопросы: