Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 382575 - dev-python/markdown2: Python Markdown language reimplementation (new package)
Summary: dev-python/markdown2: Python Markdown language reimplementation (new package)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Maxim Koltsov (RETIRED)
URL:
Whiteboard:
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2011-09-11 08:38 UTC by Qingping Hou
Modified: 2011-09-15 12:07 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
markdown2-1.0.1.19.ebuild (markdown2-1.0.1.19.ebuild,503 bytes, text/plain)
2011-09-11 08:45 UTC, Qingping Hou
Details
markdown2-1.0.1.19-r1 (markdown2-1.0.1.19-r1.ebuild,436 bytes, text/plain)
2011-09-13 11:22 UTC, Qingping Hou
Details
markdown2-1.0.1.19-r2.ebuild (markdown2-1.0.1.19-r2.ebuild,523 bytes, text/plain)
2011-09-13 15:07 UTC, Qingping Hou
Details
metadata.xml (metadata.xml,429 bytes, text/plain)
2011-09-13 15:08 UTC, Qingping Hou
Details
markdown2-1.0.1.19-r3.ebuild (markdown2-1.0.1.19-r3.ebuild,602 bytes, text/plain)
2011-09-15 04:57 UTC, Qingping Hou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Qingping Hou 2011-09-11 08:38:08 UTC
ebuild for markdown2 python module
Comment 1 Qingping Hou 2011-09-11 08:45:35 UTC
Created attachment 286093 [details]
markdown2-1.0.1.19.ebuild
Comment 2 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-13 05:29:26 UTC
> SUPPORT_PYTHON_ABIS=""
> RESTRICT_PYTHON_ABIS=""
What is this supposed to mean?

> inherit distutils 
I've been taught to explicitly include python.eclass :)

> SRC_URI="http://pypi.python.org/packages/source/m/markdown2/${P}.zip"
Use "mirror://pypi".

> KEYWORDS="~x86 ~amd64"
Sort alphabetically.

> DEPEND=">=virtual/python-2.4"
No way. Use PYTHON_DEPEND.

Take a look at http://www.gentoo.org/proj/en/Python/developersguide.xml.
Comment 3 Qingping Hou 2011-09-13 11:21:54 UTC
Thanks for pointing out my bad habits. :-)

Please checkout the new uploaded ebuild.

(In reply to comment #2)
> > SUPPORT_PYTHON_ABIS=""
> > RESTRICT_PYTHON_ABIS=""
> What is this supposed to mean?
> 
> > inherit distutils 
> I've been taught to explicitly include python.eclass :)
> 
> > SRC_URI="http://pypi.python.org/packages/source/m/markdown2/${P}.zip"
> Use "mirror://pypi".
> 
> > KEYWORDS="~x86 ~amd64"
> Sort alphabetically.
> 
> > DEPEND=">=virtual/python-2.4"
> No way. Use PYTHON_DEPEND.
> 
> Take a look at http://www.gentoo.org/proj/en/Python/developersguide.xml.
Comment 4 Qingping Hou 2011-09-13 11:22:26 UTC
Created attachment 286337 [details]
markdown2-1.0.1.19-r1
Comment 5 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-13 11:32:59 UTC
(In reply to comment #4)
> Created attachment 286337 [details]
> markdown2-1.0.1.19-r1

Seems ok. Does it pass repoman testing? Does the package have test suite?
Comment 6 Qingping Hou 2011-09-13 13:08:18 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Created attachment 286337 [details]
> > markdown2-1.0.1.19-r1
> 
> Seems ok. Does it pass repoman testing? Does the package have test suite?

Yes, but after I added the test suite, it keep telling me:

>>> Test phase [not enabled]

Even though I added FEATURES="maketest". How can I fix this?


Also, I did not look closely into the emerge info generated by the new ebuild. Seems that it does not emerge properly. :-( 

Here is what I get:

>>> Installing (1 of 1) dev-python/markdown2-1.0.1.19-r1
 * checking 0 files for package collisions
>>> Merging dev-python/markdown2-1.0.1.19-r1 to /
>>> Safely unmerging already-installed instance...
No package files given... Grabbing a set.
<<<          obj /usr/lib64/python2.7/site-packages/markdown2.py
<<<          obj /usr/lib64/python2.7/site-packages/markdown2-1.0.1.19-py2.7.egg-info
<<<          obj /usr/bin/markdown2
--- !empty   dir /usr/lib64/python2.7/site-packages
--- !empty   dir /usr/lib64/python2.7
--- !empty   dir /usr/lib64
--- !empty   dir /usr/bin
--- !empty   dir /usr
>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> dev-python/markdown2-1.0.1.19-r1 merged.
>>> Auto-cleaning packages...

I must have used python.eclass wrong. I've checkout other ebuilds using python eclass but all the ebuild I found uses stuff like emake install. Could you give me some hints on using python eclass with setuptools?
Comment 7 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-13 13:34:24 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > Created attachment 286337 [details]
> > > markdown2-1.0.1.19-r1
> > 
> > Seems ok. Does it pass repoman testing? Does the package have test suite?
> 
> Yes, but after I added the test suite, it keep telling me:
> 
> >>> Test phase [not enabled]
> 
> Even though I added FEATURES="maketest". How can I fix this?
> 
It is FEATURES="test", not "maketest". Paste ebuild with testsuite enabled please.

> 
> I must have used python.eclass wrong. I've checkout other ebuilds using python
> eclass but all the ebuild I found uses stuff like emake install. Could you give
> me some hints on using python eclass with setuptools?

I don't see anything bad in that log. setuptools are compatible with distutils, so distutils_src_install() handles that, just ensure it's called in src_install phase.
Comment 8 Qingping Hou 2011-09-13 15:07:49 UTC
Created attachment 286349 [details]
markdown2-1.0.1.19-r2.ebuild
Comment 9 Qingping Hou 2011-09-13 15:08:07 UTC
Created attachment 286351 [details]
metadata.xml
Comment 10 Qingping Hou 2011-09-13 15:10:23 UTC
Thank you for all the instructions you gave to me. :-)

New ebuild uploaded, it passed the repoman testing on my PC.

(In reply to comment #7)
> It is FEATURES="test", not "maketest". Paste ebuild with testsuite enabled
> please.
> 
> > 
> > I must have used python.eclass wrong. I've checkout other ebuilds using python
> > eclass but all the ebuild I found uses stuff like emake install. Could you give
> > me some hints on using python eclass with setuptools?
> 
> I don't see anything bad in that log. setuptools are compatible with distutils,
> so distutils_src_install() handles that, just ensure it's called in src_install
> phase.
Comment 11 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-13 15:35:55 UTC
(In reply to comment #10)
> Thank you for all the instructions you gave to me. :-)
> 
> New ebuild uploaded, it passed the repoman testing on my PC.

Seems nice. Try setting DISTUTILS_SRC_TEST="setup.py" and removing src_test().
Comment 12 Arfrever Frehtes Taifersar Arahesis 2011-09-13 19:27:54 UTC
(In reply to comment #2)
> > inherit distutils 
> I've been taught to explicitly include python.eclass :)

Please don't explicitly inherit python.eclass when distutils.eclass is inherited.
Comment 13 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-13 19:32:43 UTC
(In reply to comment #12)
> (In reply to comment #2)
> > > inherit distutils 
> > I've been taught to explicitly include python.eclass :)
> 
> Please don't explicitly inherit python.eclass when distutils.eclass is
> inherited.

I remember that in the very begging of my way someone, probably Tommy[D], said to me: always inherit all directly used eclasses, including python. I appologize for not being aware with modern rules in Gentoo Python project.
Comment 14 Qingping Hou 2011-09-14 05:54:05 UTC
(In reply to comment #11)
> Seems nice. Try setting DISTUTILS_SRC_TEST="setup.py" and removing src_test().

After set DISTUTILS_SRC_TEST="setup.py" and removed src_test(), I get following error when emerge with test FEATURES:

>>> Source compiled.
PYTHONPATH=build/lib python2.7 setup.py test
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'test'
 * ERROR: dev-python/markdown2-1.0.1.19-r3 failed (test phase):
 *   Testing failed
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_test
 *   environment, line 3702:  Called distutils_src_test
 *   environment, line 1147:  Called die
 * The specific snippet of code:
 *                   PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed";


Following is the ebuild I that modified:

EAPI=3
PYTHON_DEPEND="2:2.4"
DISTUTILS_SRC_TEST="setup.py"

inherit distutils

DESCRIPTION="Python Markdown language reimplementation"
SRC_URI="mirror://pypi/m/markdown2/${P}.zip"
HOMEPAGE="https://github.com/trentm/python-markdown2"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND=""
RDEPEND="${DEPEND}"
Comment 15 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-14 06:01:42 UTC
Ah, i'm sorry, i guided you wrong. Previous ebuild, with src_test(), was good.
Comment 16 Qingping Hou 2011-09-14 07:47:29 UTC
(In reply to comment #15)
> Ah, i'm sorry, i guided you wrong. Previous ebuild, with src_test(), was good.

Ok, finally, it's done. That's a long story. :-)
Comment 17 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-14 07:55:39 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > Ah, i'm sorry, i guided you wrong. Previous ebuild, with src_test(), was good.
> 
> Ok, finally, it's done. That's a long story. :-)

Yeah. So now you want it to be in tree. Can you tell why it's better than original markdown?
Comment 18 Mike Gilbert gentoo-dev 2011-09-14 15:40:35 UTC
Once more technical comment: I suggest setting the following variables to enable support for multiple python ABIs.

SUPPORT_PYTHON_ABIS=1
RESTRICT_PYTHON_ABIS="3.*"
Comment 19 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-14 15:44:32 UTC
(In reply to comment #18)
> Once more technical comment: I suggest setting the following variables to
> enable support for multiple python ABIs.
> 
> SUPPORT_PYTHON_ABIS=1
You're right, i missed them not being set.

> RESTRICT_PYTHON_ABIS="3.*"
Why you are sure it won't work on py3?
Comment 20 Mike Gilbert gentoo-dev 2011-09-14 15:57:21 UTC
(In reply to comment #19)
> > RESTRICT_PYTHON_ABIS="3.*"
> Why you are sure it won't work on py3?

I just tested it, the src_compile throws an error.

 * Building of dev-python/markdown2-1.0.1.19-r2 with CPython 3.1...
python3.1 setup.py build -b build-3.1
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import markdown2
  File "/var/tmp/portage/dev-python/markdown2-1.0.1.19-r2/work/markdown2-1.0.1.19/lib/markdown2.py", line 575
    except ValueError, ex:

Also, src_test must be changed for multi-abi support.

src_test() {
    cd test || die
    testing() {
        PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" test.py
    }
    python_execute_function testing
}
Comment 21 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-14 16:04:40 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > > RESTRICT_PYTHON_ABIS="3.*"
> > Why you are sure it won't work on py3?
> 
> I just tested it, the src_compile throws an error.
> 
>  * Building of dev-python/markdown2-1.0.1.19-r2 with CPython 3.1...
> python3.1 setup.py build -b build-3.1
> Traceback (most recent call last):
>   File "setup.py", line 11, in <module>
>     import markdown2
>   File
> "/var/tmp/portage/dev-python/markdown2-1.0.1.19-r2/work/markdown2-1.0.1.19/lib/markdown2.py",
> line 575
>     except ValueError, ex:
That is silly, should be reported upstream. Though it can drop 2.4 compability.

> Also, src_test must be changed for multi-abi support.
> 
> src_test() {
>     cd test || die
>     testing() {
>         PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" test.py
>     }
>     python_execute_function testing
> }
Yes, it's right.
Comment 22 Qingping Hou 2011-09-15 02:02:28 UTC
(In reply to comment #18)
> Once more technical comment: I suggest setting the following variables to
> enable support for multiple python ABIs.
> 
> SUPPORT_PYTHON_ABIS=1
> RESTRICT_PYTHON_ABIS="3.*"

So, what's the difference between:

  SUPPORT_PYTHON_ABIS=1
  RESTRICT_PYTHON_ABIS="3.*"

and

  PYTHON_DEPEND="2:2.4"

You mean that we should always use SUPPORT_PYTHON_ABIS=1 ?
Comment 23 Qingping Hou 2011-09-15 02:03:30 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > Once more technical comment: I suggest setting the following variables to
> > enable support for multiple python ABIs.
> > 
> > SUPPORT_PYTHON_ABIS=1
> You're right, i missed them not being set.
> 
> > RESTRICT_PYTHON_ABIS="3.*"
> Why you are sure it won't work on py3?

There is a request for py3 support in the issue page, though not handled yet.
Comment 24 Mike Gilbert gentoo-dev 2011-09-15 04:14:52 UTC
(In reply to comment #22)

PYTHON_DEPEND controls the contents of DEPEND and RDEPEND variables.

RESTRICT_PYTHON_ABIS controls which python slots the ebuild will target if SUPPORT_PYTHON_ABIS is set.

PYTHON_DEPEND and RESTRICT_PYTHON_ABIS should ideally be linked in some way, but this link has not yet been implemented in the main portage tree.
Comment 25 Qingping Hou 2011-09-15 04:57:12 UTC
Created attachment 286511 [details]
markdown2-1.0.1.19-r3.ebuild
Comment 26 Qingping Hou 2011-09-15 04:57:50 UTC
(In reply to comment #24)
> (In reply to comment #22)
> 
> PYTHON_DEPEND controls the contents of DEPEND and RDEPEND variables.
> 
> RESTRICT_PYTHON_ABIS controls which python slots the ebuild will target if
> SUPPORT_PYTHON_ABIS is set.
> 
> PYTHON_DEPEND and RESTRICT_PYTHON_ABIS should ideally be linked in some way,
> but this link has not yet been implemented in the main portage tree.

I see, thanks Mike. :-)

New ebuild have been loaded.
Comment 27 Qingping Hou 2011-09-15 05:02:58 UTC
(In reply to comment #17)
> (In reply to comment #16)
> > (In reply to comment #15)
> > > Ah, i'm sorry, i guided you wrong. Previous ebuild, with src_test(), was good.
> > 
> > Ok, finally, it's done. That's a long story. :-)
> 
> Yeah. So now you want it to be in tree. Can you tell why it's better than
> original markdown?

As for the reason, I may say it just works for me. ;-P I have a little script that generate static content for me with the help of markdown2.

The api seems to be simpler than the original markdown. And its claimed to be faster on its homepage, though I do not have time to test it.
Comment 28 Maxim Koltsov (RETIRED) gentoo-dev 2011-09-15 12:07:34 UTC
Ok, i added it to tree with pygments dependency. Happy using :)