Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/black/files/, dev-python/black/
Date: Tue, 02 Jun 2020 22:15:36
Message-Id: 1591136127.17e0e5f755f73bbd8dfa1bc3a4b70b3f7dd03495.chutzpah@gentoo
1 commit: 17e0e5f755f73bbd8dfa1bc3a4b70b3f7dd03495
2 Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
3 AuthorDate: Tue Jun 2 22:15:19 2020 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 2 22:15:27 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17e0e5f7
7
8 dev-python/black: New package
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.100, Repoman-2.3.22
12 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
13
14 dev-python/black/Manifest | 1 +
15 dev-python/black/black-19.10_beta0.ebuild | 63 ++++++++++++++++++++++
16 .../files/black-19.10_beta0-setuptools_scm.patch | 24 +++++++++
17 dev-python/black/metadata.xml | 8 +++
18 4 files changed, 96 insertions(+)
19
20 diff --git a/dev-python/black/Manifest b/dev-python/black/Manifest
21 new file mode 100644
22 index 00000000000..c2901bc64e1
23 --- /dev/null
24 +++ b/dev-python/black/Manifest
25 @@ -0,0 +1 @@
26 +DIST black-19.10b0.tar.gz 1008099 BLAKE2B e8a6e286e7a60f880f8b5d37a2b07278faeb4efffd15feb511764e449c36b4e54d5ac5b910f583a15948a2f92eb5e61ae210073be7a57251b2b01e69d2e5b373 SHA512 778909c26afa65548a77524451b50a2692a7b4e297fa52fc80567f7fea94dd5aae9e61cf0f1de718c28a733f1813c8e2c6974ab58e6b0e891de331bb4f245968
27
28 diff --git a/dev-python/black/black-19.10_beta0.ebuild b/dev-python/black/black-19.10_beta0.ebuild
29 new file mode 100644
30 index 00000000000..5db71277f7f
31 --- /dev/null
32 +++ b/dev-python/black/black-19.10_beta0.ebuild
33 @@ -0,0 +1,63 @@
34 +# Copyright 2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +PYTHON_COMPAT=( python3_{6,7,8} )
40 +DISTUTILS_USE_SETUPTOOLS=rdepend
41 +inherit eutils distutils-r1
42 +
43 +MY_PV="${PV//_beta/b}"
44 +MY_P="${PN}-${MY_PV}"
45 +
46 +DESCRIPTION="The uncompromising Python code formatter"
47 +HOMEPAGE="https://black.readthedocs.io/en/stable/ https://github.com/psf/black"
48 +SRC_URI="https://github.com/psf/${PN}/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
49 +S="${WORKDIR}/${MY_P}"
50 +
51 +LICENSE="MIT"
52 +SLOT="0"
53 +KEYWORDS="~amd64 ~x86"
54 +IUSE="test"
55 +
56 +RDEPEND="
57 + dev-python/click[${PYTHON_USEDEP}]
58 + dev-python/attrs[${PYTHON_USEDEP}]
59 + dev-python/appdirs[${PYTHON_USEDEP}]
60 + dev-python/toml[${PYTHON_USEDEP}]
61 + dev-python/typed-ast[${PYTHON_USEDEP}]
62 + dev-python/regex[${PYTHON_USEDEP}]
63 + dev-python/pathspec[${PYTHON_USEDEP}]
64 +"
65 +BDEPEND="${RDEPEND}
66 + test? (
67 + dev-python/aiohttp[${PYTHON_USEDEP}]
68 + dev-python/aiohttp-cors[${PYTHON_USEDEP}]
69 + )
70 +"
71 +
72 +PATCHES=(
73 + "${FILESDIR}/black-19.10_beta0-setuptools_scm.patch"
74 +)
75 +
76 +distutils_enable_tests unittest
77 +
78 +python_prepare_all() {
79 + local version_path
80 + version_path="$(grep '"write_to"' setup.py | \
81 + sed -r 's|[[:space:]]+"write_to": "([[:graph:]]+)",|\1|' \
82 + || die "could not find path to write version to")"
83 +
84 + [[ -e ${version_path} ]] && die "could not find path to write version to"
85 + printf 'version = "%s"\n' "${MY_PV}" > "${version_path}" || die "error writing version"
86 +
87 + distutils-r1_python_prepare_all
88 +}
89 +
90 +python_test() {
91 + "${EPYTHON}" tests/test_black.py -v || die "tests failed with ${EPYTHON}"
92 +}
93 +
94 +pkg_postinst() {
95 + optfeature "blackd - HTTP API for black" dev-python/aiohttp dev-python/aiohttp-cors
96 +}
97
98 diff --git a/dev-python/black/files/black-19.10_beta0-setuptools_scm.patch b/dev-python/black/files/black-19.10_beta0-setuptools_scm.patch
99 new file mode 100644
100 index 00000000000..21f99648038
101 --- /dev/null
102 +++ b/dev-python/black/files/black-19.10_beta0-setuptools_scm.patch
103 @@ -0,0 +1,24 @@
104 +diff --git a/setup.py b/setup.py
105 +index 614a8d6..66946b2 100644
106 +--- a/setup.py
107 ++++ b/setup.py
108 +@@ -1,6 +1,7 @@
109 + # Copyright (C) 2018 Ɓukasz Langa
110 + from setuptools import setup
111 + import sys
112 ++import os
113 +
114 + assert sys.version_info >= (3, 6, 0), "black requires Python 3.6+"
115 + from pathlib import Path # noqa E402
116 +@@ -17,10 +18,7 @@ def get_long_description() -> str:
117 +
118 + setup(
119 + name="black",
120 +- use_scm_version={
121 +- "write_to": "_black_version.py",
122 +- "write_to_template": 'version = "{version}"\n',
123 +- },
124 ++ version=os.getenv("MY_PV"),
125 + description="The uncompromising code formatter.",
126 + long_description=get_long_description(),
127 + long_description_content_type="text/markdown",
128
129 diff --git a/dev-python/black/metadata.xml b/dev-python/black/metadata.xml
130 new file mode 100644
131 index 00000000000..56cae167d37
132 --- /dev/null
133 +++ b/dev-python/black/metadata.xml
134 @@ -0,0 +1,8 @@
135 +<?xml version="1.0" encoding="UTF-8"?>
136 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
137 +<pkgmetadata>
138 + <maintainer type="person">
139 + <email>chutzpah@g.o</email>
140 + <name>Patrick McLean</name>
141 + </maintainer>
142 +</pkgmetadata>