mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Artur Wiebe" <artur@4wiebe.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist]  [PATCH 3/3] python3-cryptography:  Python package that wants to compile with rust and cargo...
Date: Mon, 27 Mar 2023 16:28:56 +0200	[thread overview]
Message-ID: <143ed7-6421a800-91-6821c100@118252765> (raw)
In-Reply-To: <20230327140915.3253285-3-artur@4wiebe.de>

Hi,

cryptography is a python package that uses setuptools-rust to compile a module with rust/cargo.
This is the first one in PTXdist, but I think it will not be the last.
It is needed by python3-asyncua (OPC/UA) that I am trying to add.

While pure cargo packages already work well (I've tried few weeks ago), the python-setuptools scenario is not covered yet.

I am not that deep into PTXdist so I could send a patch. I hope someone can help.

My suggestion is to add a PKG_CARGO_LOCK variable that points to the Cargo.lock file.
If it exists ptxdist cargosync should use it and also CARGO_HOME should be set in env. 

PYTHON3_CRYPTOGRAPHY_CARGO_LOCK := $(PYTHON3_CRYPTOGRAPHY_DIR)/src/rust/Cargo.lock

BR,
Artur


On Monday, 27 March, 2023 16:09 CEST, Artur Wiebe <artur@4wiebe.de> wrote:

> ---
>  rules/python3-cryptography.in   | 10 ++++++
>  rules/python3-cryptography.make | 56 +++++++++++++++++++++++++++++++++
>  2 files changed, 66 insertions(+)
>  create mode 100644 rules/python3-cryptography.in
>  create mode 100644 rules/python3-cryptography.make
> 
> diff --git a/rules/python3-cryptography.in b/rules/python3-cryptography.in
> new file mode 100644
> index 000000000..97187de02
> --- /dev/null
> +++ b/rules/python3-cryptography.in
> @@ -0,0 +1,10 @@
> +## SECTION=python3
> +
> +config PYTHON3_CRYPTOGRAPHY
> +	tristate
> +	select PYTHON3
> +	select HOST_PYTHON3_SETUPTOOLS_RUST
> +	prompt "cryptography"
> +	help
> +	  Cryptography is a package which provides cryptographic recipes and primitives to Python developers.
> +	  Our goal is for it to be your “cryptographic standard library”
> diff --git a/rules/python3-cryptography.make b/rules/python3-cryptography.make
> new file mode 100644
> index 000000000..7c5ac9885
> --- /dev/null
> +++ b/rules/python3-cryptography.make
> @@ -0,0 +1,56 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2023 by Artur Wiebe <artur@4wiebe.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_PYTHON3_CRYPTOGRAPHY) += python3-cryptography
> +
> +#
> +# Paths and names
> +#
> +PYTHON3_CRYPTOGRAPHY_VERSION		:= 40.0.1
> +PYTHON3_CRYPTOGRAPHY_MD5		:= 24dec990fce1d4a614ad86076c8e347f
> +PYTHON3_CRYPTOGRAPHY			:= cryptography-$(PYTHON3_CRYPTOGRAPHY_VERSION)
> +PYTHON3_CRYPTOGRAPHY_SUFFIX		:= tar.gz
> +PYTHON3_CRYPTOGRAPHY_URL		:= $(call ptx/mirror-pypi, cryptography, $(PYTHON3_CRYPTOGRAPHY).$(PYTHON3_CRYPTOGRAPHY_SUFFIX))
> +PYTHON3_CRYPTOGRAPHY_SOURCE		:= $(SRCDIR)/$(PYTHON3_CRYPTOGRAPHY).$(PYTHON3_CRYPTOGRAPHY_SUFFIX)
> +PYTHON3_CRYPTOGRAPHY_DIR		:= $(BUILDDIR)/$(PYTHON3_CRYPTOGRAPHY)
> +PYTHON3_CRYPTOGRAPHY_LICENSE		:= Apache-2.0 OR BSD-3-Clause
> +PYTHON3_CRYPTOGRAPHY_LICENSE_FILES	:=
> +
> +PYTHON3_CRYPTOGRAPHY_CARGO_LOCK		:= $(PYTHON3_CRYPTOGRAPHY_DIR)/src/rust/Cargo.lock
> +
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +PYTHON3_CRYPTOGRAPHY_CONF_TOOL	:= python3
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/python3-cryptography.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, python3-cryptography)
> +	@$(call install_fixup, python3-cryptography,PRIORITY,optional)
> +	@$(call install_fixup, python3-cryptography,SECTION,base)
> +	@$(call install_fixup, python3-cryptography,AUTHOR,"Artur Wiebe <artur@4wiebe.de>")
> +	@$(call install_fixup, python3-cryptography,DESCRIPTION,missing)
> +
> +	@$(call install_glob, python3-cryptography, 0, 0, -, \
> +		$(PYTHON3_SITEPACKAGES),, *.py)
> +
> +	@$(call install_finish, python3-cryptography)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.39.2
> 
>




  reply	other threads:[~2023-03-27 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 14:09 [ptxdist] [PATCH 1/3] python3-semantic-version: new package Artur Wiebe
2023-03-27 14:09 ` [ptxdist] [PATCH 2/3] host-python3-setuptools-rust: " Artur Wiebe
2023-03-27 14:09 ` [ptxdist] [PATCH 3/3] python3-cryptography: Python package that wants to compile with rust and cargo Artur Wiebe
2023-03-27 14:28   ` Artur Wiebe [this message]
2023-04-06 20:09   ` Roland Hieber
2023-04-06 20:08 ` [ptxdist] [PATCH 1/3] python3-semantic-version: new package Roland Hieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=143ed7-6421a800-91-6821c100@118252765 \
    --to=artur@4wiebe.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox