setup.py에서 여러 작성자 / 이메일을 지정하는 방법
트위터 앱에 작은 래퍼를 작성하고이 정보를 http://pypi.python.org에 게시했습니다 . 그러나 setup.py에는 작성자의 이메일 / 이름을 지정하기위한 단일 필드 만 포함되어 있습니다. 우리가에 표시하는 방법을 많이 유사한,이 패키지는 우리의 이름 아래에 나열 싶습니다 이후 어떻게 다음 필드로, 여러 참여자 / 이메일 목록을 지정합니까 http://rubygems.org .
author='foo',
author_email='foo.bar@gmail.com',
내가 아는 한, setuptools여러 작성자를 지정하기 위해 문자열 목록 사용을 지원하지 않습니다. 가장 좋은 방법은 저자를 단일 문자열로 나열하는 것입니다.
author='Foo Bar, Spam Eggs',
author_email='foobar@baz.com, spameggs@joe.org',
PyPI가 author_email필드의 유효성을 검사하는지 확실하지 않으므로 해당 필드에 문제가 발생할 수 있습니다. 어쨌든, 나는 이것을 단일 저자로 제한하고 문서 또는 설명에 모든 기여자를 언급하는 것이 좋습니다.
[편집] 일부 출처 :
이것은 실제로 버그 로 등록 되었지만 여러 작성자에 대한 지원이 구현되지 않은 것 같습니다. 다음 은 대체 솔루션입니다. 다음 은 여러 작성자가있는 프로젝트에 대한 연락처 이메일을 제공하는 방법에 대한 아이디어입니다.
나는 특정 사항을 원할 경우 @modocache의 답변을 피기 백하고 있습니다.
이 답변 전체에서 FOO-PYTHON-ENV\Lib\distutils\dist.py파일 의 python3.6 버전을 참조 합니다.
다시 말하면 author필드에 목록을 사용할 수 없습니다 . 그 이유는 다음과 같습니다.
스포일러 : DistributionMetadata클래스에 속하는 두 가지 방법 이 이유입니다.
def _read_field(name):
value = msg[name]
if value == 'UNKNOWN':
return None
return value
def _read_list(name):
values = msg.get_all(name, None)
if values == []:
return None
return values
author필드에 목록을 추가하려고하면 오류가 발생하는 곳은 다음과 같습니다 .
class DistributionMetadata:
#*...(R E D A C T E D)...*#
def read_pkg_file(self, file):
"""Reads the metadata values from a file object."""
#*...(R E D A C T E D)...*#
# ####################################
# Note the usage of _read_field() here
# ####################################
self.name = _read_field('name')
self.version = _read_field('version')
self.description = _read_field('summary')
# we are filling author only.
self.author = _read_field('author')
self.maintainer = None
self.author_email = _read_field('author-email')
self.maintainer_email = None
self.url = _read_field('home-page')
self.license = _read_field('license')
#*...(R E D A C T E D)...*#
# ###################################
# Note the usage of _read_list() here
# ###################################
self.platforms = _read_list('platform')
self.classifiers = _read_list('classifier')
#*...(R E D A C T E D)...*#
& 전체 내용은 다음과 같습니다.
class DistributionMetadata:
"""Dummy class to hold the distribution meta-data: name, version,
author, and so forth.
"""
_METHOD_BASENAMES = ("name", "version", "author", "author_email",
"maintainer", "maintainer_email", "url",
"license", "description", "long_description",
"keywords", "platforms", "fullname", "contact",
"contact_email", "classifiers", "download_url",
# PEP 314
"provides", "requires", "obsoletes",
)
def __init__(self, path=None):
if path is not None:
self.read_pkg_file(open(path))
else:
self.name = None
self.version = None
self.author = None
self.author_email = None
self.maintainer = None
self.maintainer_email = None
self.url = None
self.license = None
self.description = None
self.long_description = None
self.keywords = None
self.platforms = None
self.classifiers = None
self.download_url = None
# PEP 314
self.provides = None
self.requires = None
self.obsoletes = None
def read_pkg_file(self, file):
"""Reads the metadata values from a file object."""
msg = message_from_file(file)
def _read_field(name):
value = msg[name]
if value == 'UNKNOWN':
return None
return value
def _read_list(name):
values = msg.get_all(name, None)
if values == []:
return None
return values
metadata_version = msg['metadata-version']
self.name = _read_field('name')
self.version = _read_field('version')
self.description = _read_field('summary')
# we are filling author only.
self.author = _read_field('author')
self.maintainer = None
self.author_email = _read_field('author-email')
self.maintainer_email = None
self.url = _read_field('home-page')
self.license = _read_field('license')
if 'download-url' in msg:
self.download_url = _read_field('download-url')
else:
self.download_url = None
self.long_description = _read_field('description')
self.description = _read_field('summary')
if 'keywords' in msg:
self.keywords = _read_field('keywords').split(',')
self.platforms = _read_list('platform')
self.classifiers = _read_list('classifier')
# PEP 314 - these fields only exist in 1.1
if metadata_version == '1.1':
self.requires = _read_list('requires')
self.provides = _read_list('provides')
self.obsoletes = _read_list('obsoletes')
else:
self.requires = None
self.provides = None
self.obsoletes = None
참고 URL : https://stackoverflow.com/questions/9999829/how-to-specify-multiple-authors-emails-in-setup-py
'Program Club' 카테고리의 다른 글
| DTO를 도메인 개체에 매핑하는 모범 사례 (0) | 2020.11.05 |
|---|---|
| 콘텐츠 높이에 따라 iframe 높이 크기 조정 (0) | 2020.11.05 |
| 신경망 역 전파의 편향을 업데이트하는 방법은 무엇입니까? (0) | 2020.11.05 |
| 하나의 PHP 포함 파일에서 다른 파일로 변수 전달 : 글로벌 vs. 아님 (0) | 2020.11.05 |
| iOS6 UDID-identifierForVendor가 identifierForAdvertising에 비해 어떤 이점이 있습니까? (0) | 2020.11.05 |