dev-python/black: New package

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
This commit is contained in:
Patrick McLean
2020-06-02 15:15:19 -07:00
committed by Patrick McLean
parent 68028f7704
commit 17e0e5f755
4 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST black-19.10b0.tar.gz 1008099 BLAKE2B e8a6e286e7a60f880f8b5d37a2b07278faeb4efffd15feb511764e449c36b4e54d5ac5b910f583a15948a2f92eb5e61ae210073be7a57251b2b01e69d2e5b373 SHA512 778909c26afa65548a77524451b50a2692a7b4e297fa52fc80567f7fea94dd5aae9e61cf0f1de718c28a733f1813c8e2c6974ab58e6b0e891de331bb4f245968

View File

@@ -0,0 +1,63 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6,7,8} )
DISTUTILS_USE_SETUPTOOLS=rdepend
inherit eutils distutils-r1
MY_PV="${PV//_beta/b}"
MY_P="${PN}-${MY_PV}"
DESCRIPTION="The uncompromising Python code formatter"
HOMEPAGE="https://black.readthedocs.io/en/stable/ https://github.com/psf/black"
SRC_URI="https://github.com/psf/${PN}/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"
RDEPEND="
dev-python/click[${PYTHON_USEDEP}]
dev-python/attrs[${PYTHON_USEDEP}]
dev-python/appdirs[${PYTHON_USEDEP}]
dev-python/toml[${PYTHON_USEDEP}]
dev-python/typed-ast[${PYTHON_USEDEP}]
dev-python/regex[${PYTHON_USEDEP}]
dev-python/pathspec[${PYTHON_USEDEP}]
"
BDEPEND="${RDEPEND}
test? (
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/aiohttp-cors[${PYTHON_USEDEP}]
)
"
PATCHES=(
"${FILESDIR}/black-19.10_beta0-setuptools_scm.patch"
)
distutils_enable_tests unittest
python_prepare_all() {
local version_path
version_path="$(grep '"write_to"' setup.py | \
sed -r 's|[[:space:]]+"write_to": "([[:graph:]]+)",|\1|' \
|| die "could not find path to write version to")"
[[ -e ${version_path} ]] && die "could not find path to write version to"
printf 'version = "%s"\n' "${MY_PV}" > "${version_path}" || die "error writing version"
distutils-r1_python_prepare_all
}
python_test() {
"${EPYTHON}" tests/test_black.py -v || die "tests failed with ${EPYTHON}"
}
pkg_postinst() {
optfeature "blackd - HTTP API for black" dev-python/aiohttp dev-python/aiohttp-cors
}

View File

@@ -0,0 +1,24 @@
diff --git a/setup.py b/setup.py
index 614a8d6..66946b2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
# Copyright (C) 2018 Łukasz Langa
from setuptools import setup
import sys
+import os
assert sys.version_info >= (3, 6, 0), "black requires Python 3.6+"
from pathlib import Path # noqa E402
@@ -17,10 +18,7 @@ def get_long_description() -> str:
setup(
name="black",
- use_scm_version={
- "write_to": "_black_version.py",
- "write_to_template": 'version = "{version}"\n',
- },
+ version=os.getenv("MY_PV"),
description="The uncompromising code formatter.",
long_description=get_long_description(),
long_description_content_type="text/markdown",

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>chutzpah@gentoo.org</email>
<name>Patrick McLean</name>
</maintainer>
</pkgmetadata>