Quantcast

[PATCH GPGME] python: build: reinstate prepare target

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH GPGME] python: build: reinstate prepare target

Alon Bar-Lev-3
* lang/python/Makefile.am: fix prepare target
* lang/python/setup.py.in: abs_top_builddir handling

--

prepare will prepare target at PREPAREDIR
the automake will make use of prepare target
downstream may also make use of prepare target
outcome of splitting it is standard make error checking for each command

running setup.py in-tree requires abs_top_builddir environment to be set
to avoid guessing process.

Signed-off-by: Alon Bar-Lev <[hidden email]>
---
 lang/python/Makefile.am | 25 +++++++++++++++----------
 lang/python/setup.py.in |  9 +++++----
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index d91ead9..a18a014 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -44,17 +44,22 @@ COPY_FILES_GPG = \
  $(srcdir)/gpg/results.py \
  $(srcdir)/gpg/util.py
 
+.PHONY: prepare
+prepare:
+ test -n "$(PREPAREDIR)"
+ $(MKDIR_P)              "$(PREPAREDIR)/gpg"
+ cp -R $(COPY_FILES)     "$(PREPAREDIR)"
+ cp setup.py             "$(PREPAREDIR)"
+ cp gpg/version.py       "$(PREPAREDIR)/gpg"
+ ln -sf "$(abs_top_srcdir)/src/data.h" "$(PREPAREDIR)"
+ ln -sf "$(abs_top_builddir)/config.h" "$(PREPAREDIR)"
+ cp -R $(COPY_FILES_GPG) "$(PREPAREDIR)/gpg"
+
 # For VPATH builds we need to copy some files because Python's
 # distutils are not VPATH-aware.
 copystamp: $(COPY_FILES) $(COPY_FILES_GPG)
  set -e ; for VERSION in $(PYTHON_VERSIONS); do \
-  $(MKDIR_P)              python$${VERSION}-gpg/gpg ; \
-  cp -R $(COPY_FILES)     python$${VERSION}-gpg ; \
-  cp setup.py             python$${VERSION}-gpg ; \
-  cp gpg/version.py       python$${VERSION}-gpg/gpg ; \
-  ln -sf "$(abs_top_srcdir)/src/data.h" python$${VERSION}-gpg ; \
-  ln -sf "$(abs_top_builddir)/config.h" python$${VERSION}-gpg ; \
-  cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \
+  $(MAKE) PREPAREDIR=python$${VERSION}-gpg prepare; \
  done
  touch $@
 
@@ -63,6 +68,7 @@ all-local: copystamp
   PYTHON="$$1" ; shift ; \
   cd python$${VERSION}-gpg && \
   CFLAGS="$(CFLAGS)" \
+  abs_top_builddir="$(abs_top_builddir)" \
     $$PYTHON setup.py build --verbose ; \
   cd .. ; \
  done
@@ -71,12 +77,10 @@ python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \
 python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp
  cd python$(PYTHON_VERSION)-gpg && \
  CFLAGS="$(CFLAGS)" \
+ abs_top_builddir="$(abs_top_builddir)" \
   $(PYTHON) setup.py sdist --verbose
  gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz
 
-.PHONY: prepare
-prepare: copystamp
-
 .PHONY: sdist
 sdist: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \
        python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc
@@ -104,6 +108,7 @@ install-exec-local:
  set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
   PYTHON="$$1" ; shift ; \
   cd python$${VERSION}-gpg ; \
+  abs_top_builddir="$(abs_top_builddir)" \
   $$PYTHON setup.py install \
   --prefix $(DESTDIR)$(prefix) \
   --record files.txt \
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index bf4efa3..8ddbf27 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -34,12 +34,13 @@ in_tree = False
 extra_swig_opts = []
 extra_macros = dict()
 
-if os.path.exists("../../../src/gpgme-config"):
+abs_top_builddir = os.environ.get("abs_top_builddir")
+if abs_top_builddir:
     # In-tree build.
     in_tree = True
-    gpgme_config = ["../../../src/gpgme-config"] + gpgme_config_flags
-    gpgme_h = "../../../src/gpgme.h"
-    library_dirs = ["../../../src/.libs"] # XXX uses libtool internals
+    gpgme_config = [os.path.join(abs_top_builddir, "src/gpgme-config")] + gpgme_config_flags
+    gpgme_h = os.path.join(abs_top_builddir, "src/gpgme.h")
+    library_dirs = [os.path.join(abs_top_builddir, "src/.libs")] # XXX uses libtool internals
     extra_macros.update(
         HAVE_CONFIG_H=1,
         HAVE_DATA_H=1,
--
2.10.2


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Alon Bar-Lev-3
BTW:

there is abnormality in the build system that the sources are modified
if --build-base is specified, the following files are written to
source instead to build directory or build temp directory:
      errors.i
      gpgme.h
      gpgme_wrap.c
      gpg/gpgme.py

Please consider to avoid.

Doing so will enable us to prepare a single source and then build
using separate build base using multiple python versions. This is
actually how downstream builds.

Regards,
Alon

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Justus Winter
Alon Bar-Lev <[hidden email]> writes:

> Please consider to avoid.

We are a free software project.  Please consider to submit a patch.

Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Alon Bar-Lev-3
On 29 March 2017 at 12:11, Justus Winter <[hidden email]> wrote:
>
> Alon Bar-Lev <[hidden email]> writes:
>
> > Please consider to avoid.
>
> We are a free software project.  Please consider to submit a patch.

I was hoping we first agree that this is to be fixed so that the
effort will not be wasted.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Justus Winter
In reply to this post by Alon Bar-Lev-3
Alon Bar-Lev <[hidden email]> writes:

> * lang/python/Makefile.am: fix prepare target
> * lang/python/setup.py.in: abs_top_builddir handling
>
> --
>
> prepare will prepare target at PREPAREDIR
> the automake will make use of prepare target
> downstream may also make use of prepare target
> outcome of splitting it is standard make error checking for each command
>
> running setup.py in-tree requires abs_top_builddir environment to be set
> to avoid guessing process.
>
> Signed-off-by: Alon Bar-Lev <[hidden email]>
Merged, many thanks for your contribution :)

However, in the future, even if you cannot be bothered to read our
commit message guidelines, please just try to make your message blend in
with the others.


Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Alon Bar-Lev-3
On 29 March 2017 at 12:34, Justus Winter <[hidden email]> wrote:

>
> Alon Bar-Lev <[hidden email]> writes:
>
> > * lang/python/Makefile.am: fix prepare target
> > * lang/python/setup.py.in: abs_top_builddir handling
> >
> > --
> >
> > prepare will prepare target at PREPAREDIR
> > the automake will make use of prepare target
> > downstream may also make use of prepare target
> > outcome of splitting it is standard make error checking for each command
> >
> > running setup.py in-tree requires abs_top_builddir environment to be set
> > to avoid guessing process.
> >
> > Signed-off-by: Alon Bar-Lev <[hidden email]>
>
> Merged, many thanks for your contribution :)
>
> However, in the future, even if you cannot be bothered to read our
> commit message guidelines, please just try to make your message blend in
> with the others.

I truly tried!!!
What have I missed this time?

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Justus Winter
Alon Bar-Lev <[hidden email]> writes:

> On 29 March 2017 at 12:34, Justus Winter <[hidden email]> wrote:
>> However, in the future, even if you cannot be bothered to read our
>> commit message guidelines, please just try to make your message blend in
>> with the others.
>
> I truly tried!!!

Sorry.  To my eyes, your commit message looks so out-of-place.  We are
really mostly just following GNU changelog rules.  The commit messages
of every GNU project I have contributed to are looking more or less like
this.

> What have I missed this time?

Here we go:

> python: build: reinstate prepare target
  ^       ^ multiple components, better join them with comma.
                 ^ Please use whole sentences, start with a capital
                   letter, end with a full-stop.

> * lang/python/Makefile.am: fix prepare target
                           ^ Usually, giving some (context) is good, but
                             this is tricky with Makefiles.
                             ^ Please use whole sentences, start with
                               a capital letter, end with a full-stop.

> * lang/python/setup.py.in: abs_top_builddir handling
                             ^ Please use whole sentences, start with
                               a capital letter, end with a full-stop.

> prepare will prepare target at PREPAREDIR
  ^ Please use whole sentences, start with a capital letter, end with a
    full-stop.  Please reflow this text (meta-q).
> the automake will make use of prepare target
  ^ Likewise.
> downstream may also make use of prepare target
  ^ Likewise.
> outcome of splitting it is standard make error checking for each command
  ^ Likewise.
>
> running setup.py in-tree requires abs_top_builddir environment to be set
> to avoid guessing process.
  ^ Likewise.

Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH GPGME] python: build: reinstate prepare target

Alon Bar-Lev-3
In reply to this post by Alon Bar-Lev-3
On 29 March 2017 at 12:18, Alon Bar-Lev <[hidden email]> wrote:

> On 29 March 2017 at 12:11, Justus Winter <[hidden email]> wrote:
>>
>> Alon Bar-Lev <[hidden email]> writes:
>>
>> > Please consider to avoid.
>>
>> We are a free software project.  Please consider to submit a patch.
>
> I was hoping we first agree that this is to be fixed so that the
> effort will not be wasted.

I have not gotten a response, however, I implemented a solution. I
hope I got the commit message format correct this time.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Loading...