dev-python/cmarkgfm: initial import

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2021-07-02 02:38:57 +02:00
parent 7ab1306553
commit a1474f4248
4 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST cmarkgfm-0.5.3.tar.gz 12223 BLAKE2B fadbe49a59e4de24e51d2bb3f72138a67fa786c7c4b3901dc4689d1edbac8b7c04beb73c4c77b06fec933e526fdbf75640022ad41864054e69c9ae7ba0131d90 SHA512 2c4f891ca845cfa87adc7d3ab5b20999b1747c30d66a7ed52a2e870e77fac0993207f9ff49256c7588976475cb0adb816f70d2834dc26724d6ae50ff395ca734

View File

@@ -0,0 +1,32 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{8..10} pypy3 )
inherit distutils-r1
DESCRIPTION="Python bindings for GitHub's cmark"
HOMEPAGE="https://github.com/theacodes/cmarkgfm"
SRC_URI="https://github.com/theacodes/cmarkgfm/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
KEYWORDS="~amd64"
SLOT="0"
RDEPEND="
app-text/cmark-gfm
virtual/python-cffi[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}"
BDEPEND="app-text/dos2unix"
PATCHES=( "${FILESDIR}/${P}-use-system-cmark-gfm.patch" )
src_prepare() {
dos2unix src/cmarkgfm/build_cmark.py || die
default
}
distutils_enable_tests pytest

View File

@@ -0,0 +1,47 @@
--- a/src/cmarkgfm/build_cmark.py
+++ b/src/cmarkgfm/build_cmark.py
@@ -8,12 +8,8 @@
import cffi
-# Get the directory for the cmark source files. It's under the package root
-# as /third_party/cmark/src
HERE = os.path.dirname(os.path.abspath(__file__))
PACKAGE_ROOT = os.path.abspath(os.path.join(HERE, '../../'))
-SRC_DIR = os.path.join(PACKAGE_ROOT, 'third_party/cmark/src')
-EXTENSIONS_SRC_DIR = os.path.join(PACKAGE_ROOT, 'third_party/cmark/extensions')
UNIX_GENERATED_SRC_DIR = os.path.join(PACKAGE_ROOT, 'generated', 'unix')
WIN_GENERATED_SRC_DIR = os.path.join(PACKAGE_ROOT, 'generated', 'windows')
@@ -27,20 +23,6 @@
CMARK_MODULE_H = fh.read()
-def _get_sources(dir, exclude=set()):
- sources = glob.iglob(os.path.join(dir, '*.c'))
- return sorted([
- os.path.relpath(path, start=PACKAGE_ROOT)
- for path in
- sources
- if os.path.basename(path) not in exclude
- ])
-
-
-SOURCES = _get_sources(SRC_DIR, exclude=set(['main.c']))
-SOURCES.extend(_get_sources(EXTENSIONS_SRC_DIR))
-
-
def _compiler_type():
"""
Gets the compiler type from distutils. On Windows with MSVC it will be
@@ -76,8 +58,8 @@
ffibuilder.set_source(
'cmarkgfm._cmark',
CMARK_MODULE_H,
- sources=SOURCES,
- include_dirs=[SRC_DIR, EXTENSIONS_SRC_DIR, GENERATED_SRC_DIR],
+ include_dirs=[GENERATED_SRC_DIR],
+ libraries=["cmark-gfm", "cmark-gfm-extensions"],
extra_compile_args=EXTRA_COMPILE_ARGS
)

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>lssndrbarbieri@gmail.com</email>
<name>Alessandro Barbieri</name>
</maintainer>
<upstream>
<bugs-to>https://github.com/theacodes/cmarkgfm/issues</bugs-to>
<remote-id type="github">theacodes/cmarkgfm</remote-id>
<remote-id type="pypi">cmarkgfm</remote-id>
</upstream>
</pkgmetadata>