Bug 264362 - [NEW PORT] devel/py-jschema-to-python: Generate Python classes from a JSON schema
Summary: [NEW PORT] devel/py-jschema-to-python: Generate Python classes from a JSON sc...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL: https://pypi.org/project/jschema-to-p...
Keywords:
Depends on:
Blocks: 264374
  Show dependency treegraph
 
Reported: 2022-05-31 09:47 UTC by Norikatsu Shigemura
Modified: 2022-06-10 11:43 UTC (History)
1 user (show)

See Also:


Attachments
A new port for py-jschema_to_python (2.50 KB, patch)
2022-05-31 09:47 UTC, Norikatsu Shigemura
no flags Details | Diff
complete diff - new port for py-jschema_to_python (2.90 KB, patch)
2022-06-08 18:45 UTC, Nuno Teixeira
no flags Details | Diff
jschema-to-python v2 (2.77 KB, patch)
2022-06-09 13:52 UTC, Nuno Teixeira
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norikatsu Shigemura 2022-05-31 09:47:08 UTC
Created attachment 234347 [details]
A new port for py-jschema_to_python

Add a new port, py-jschema_to_python is to generate Python classes from a JSON schema.
Comment 1 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-08 18:45:41 UTC
Created attachment 234560 [details]
complete diff - new port for py-jschema_to_python

full path and devel/Makefile category
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-08 18:46:27 UTC
Hello,

It fails to configure. Please take a look at poudriere logs:

https://people.freebsd.org/~eduardo/logs/py38-jschema_to_python-1.2.3/

Cheers
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-06-09 11:11:36 UTC
(In reply to Nuno Teixeira from comment #2)

The error message describe the problem.

> error in setup command: Error parsing /wrkdirs/usr/ports/devel/py-jschema_to_python/work-py38/jschema-to-python-1.2.3/setup.cfg: Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name jschema_to_python was given, but was not able to be found.

The problem is caused by using a tarball from GitHub.
The build should use either the sdist (from PyPI) or a complete git clone.

BTW, this should be devel/py-jschema-to-python to match PyPI naming. I can build this port successfully using the sdist from PyPI.
Comment 4 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-09 12:10:55 UTC
(In reply to Po-Chuan Hsieh from comment #3)
Hello Po-Chuan!

There is no magic MASTER_SITES macro for PyPI so we need to find a way to get tarball. What I found is that tarball is located at:

https://pypi.org/project/jschema-to-python/#files

and link is

https://files.pythonhosted.org/packages/1d/7f/5ae3d97ddd86ec33323231d68453afd504041efcfd4f4dde993196606849/jschema_to_python-1.2.3.tar.gz

any hint to include this link into port Makefile?

Cheers
Comment 5 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-09 12:57:33 UTC
(In reply to Po-Chuan Hsieh from comment #3)
Nevermind, CHEESESHOP :)
Comment 6 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-09 13:52:10 UTC
Created attachment 234581 [details]
jschema-to-python v2

- change pkg name to "jschema-to-python" to match PyPI name (sugested by @sunpoet)
- use CHEESESHOP magic macro MASTERSITES
- readjust files/patch
- use USES:..dos2unix since src files are in dos format

TODO:

- need better handling of disfile name if possible:
DISTNAME=jschema_to_python-${DISTVERSION}

BUILD: OK
BUILD LOG: https://people.freebsd.org/~eduardo/logs/py38-jschema-to-python-1.2.3/
Comment 7 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-09 13:57:13 UTC
(In reply to Po-Chuan Hsieh from comment #3)
Could you take a look at diff version 2? it compliles fine.

Thanks
Comment 8 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-06-09 14:32:44 UTC
(In reply to Nuno Teixeira from comment #7)

LGTM.

Besides, regarding of WWW, I'd like to use https://github.com/microsoft/jschema-to-python instead of the PyPI link.
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-06-09 22:18:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cdc4f394015b90c1aa11d7a9dc725e4ce0414616

commit cdc4f394015b90c1aa11d7a9dc725e4ce0414616
Author:     Norikatsu Shigemura <nork@ninth-nine.com>
AuthorDate: 2022-06-09 22:13:51 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-06-09 22:13:51 +0000

    devel/py-jschema-to-python: New Port: Generate Python classes from a JSON schema

    Add a new port, py-jschema-to-python is to generate Python classes from
    a JSON schema.

     - Author becomes maintainer

    PR:             264362

 devel/Makefile                                     |  1 +
 devel/py-jschema-to-python/Makefile (new)          | 24 ++++++++++++++++++++++
 devel/py-jschema-to-python/distinfo (new)          |  3 +++
 .../files/patch-setup.cfg (new)                    | 16 +++++++++++++++
 devel/py-jschema-to-python/pkg-descr (new)         |  3 +++
 5 files changed, 47 insertions(+)
Comment 10 Nuno Teixeira freebsd_committer freebsd_triage 2022-06-09 22:21:51 UTC
Committed, thank you!
Comment 11 Norikatsu Shigemura 2022-06-10 11:43:30 UTC
That's cool, thank you!
I'll feed back your suggestions, when I'll make a new port.