Patchwork Properly initialize version string in python-hglib setup.py

login
register
mail settings
Submitter Peter Elmers
Date July 23, 2015, 5:15 p.m.
Message ID <1483115778.1419179.1437671733567.JavaMail.yahoo@mail.yahoo.com>
Download mbox | patch
Permalink /patch/10056/
State Changes Requested
Delegated to: Matt Mackall
Headers show

Comments

Peter Elmers - July 23, 2015, 5:15 p.m.
I have updated the commit message. Unfortunately I haven't had any success configuring sendmail to work with my email account; I have included the patch below as well as in an attachment, but I believe that the whitespace is correct.
# HG changeset patch
# User Peter Elmers <peter.elmers@yahoo.com>
# Date 1437668281 25200
#      Thu Jul 23 09:18:01 2015 -0700
# Node ID ac156a42f59381d4a2d4f2a7559d9d1ca3ff024b
# Parent  ec935041d1ff0fd2aa8cb666d79e6dcca398ddba
setup: parse PKG-INFO for version information (issue3924)





     On Thursday, July 23, 2015 6:12 AM, Yuya Nishihara <yuya@tcha.org> wrote:
   

 On Tue, 21 Jul 2015 21:09:20 +0000 (UTC), Peter Elmers wrote:
> # HG changeset patch
> # User Peter Elmers <peter.elmers@yahoo.com>
> # Date 1437512568 25200
> #      Tue Jul 21 14:02:48 2015 -0700
> # Node ID 1b327fa07920e0717cf72438f07cb2afa985a833
> # Parent  ec935041d1ff0fd2aa8cb666d79e6dcca398ddba
> Issue 3924: parse PKG-INFO for version information.

We prefer "topic: summary (issueXXXX)", for example,

setup: parse PKG-INFO for version information (issue3924)

https://mercurial.selenic.com/wiki/ContributingChanges#Submission_checklist

> +elif os.path.exists('PKG-INFO'):
> +    kw = dict([[t.strip() for t in l.split(':', 1)]
> +               for l in open('PKG-INFO') if ':' in l])
> +    version = kw.get('Version', version)

The patch looks good to me, but it can't be applied because all
whitespaces are damaged. Please consider using the patchbomb extension.

https://mercurial.selenic.com/wiki/PatchbombExtension
Yuya Nishihara - July 24, 2015, 1:09 p.m.
On Thu, 23 Jul 2015 17:15:33 +0000 (UTC), Peter Elmers wrote:
> I have updated the commit message. Unfortunately I haven't had any success
> configuring sendmail to work with my email account;

Did you try an SMTP? It should be much simpler than sendmail.

> I have included the patch below as well as in an attachment,
> but I believe that the whitespace is correct.

Well, all leading whitespaces are \xc2\xa0. I can apply it by the following
command, but that doesn't mean it will be accepted by mpm.

  % xclip -sel clip -out | sed 's/\xc2\xa0/ /g' | hg patch -
Peter Elmers - July 24, 2015, 1:35 p.m.
Yuya, thanks for the help; I'll keep playing around with SMTP options to try to get something to work.
 r? mpm
 

     On Friday, July 24, 2015 6:11 AM, Yuya Nishihara <yuya@tcha.org> wrote:
   

 On Thu, 23 Jul 2015 17:15:33 +0000 (UTC), Peter Elmers wrote:
> I have updated the commit message. Unfortunately I haven't had any success
> configuring sendmail to work with my email account;

Did you try an SMTP? It should be much simpler than sendmail.

> I have included the patch below as well as in an attachment,
> but I believe that the whitespace is correct.

Well, all leading whitespaces are \xc2\xa0. I can apply it by the following
command, but that doesn't mean it will be accepted by mpm.

  % xclip -sel clip -out | sed 's/\xc2\xa0/ /g' | hg patch -
Sean Farley - July 24, 2015, 5:42 p.m.
Peter Elmers <peter.elmers@yahoo.com> writes:

> Yuya, thanks for the help; I'll keep playing around with SMTP options to try to get something to work.
> r? mpm

You can try the easier pushgate option:

https://mercurial.selenic.com/wiki/ContributingChanges#Experimental_submission_via_push_gate

Basically,

hg push http://selenic.com/repo/hg-push
Matt Mackall - July 24, 2015, 5:48 p.m.
On Fri, 2015-07-24 at 10:42 -0700, Sean Farley wrote:
> Peter Elmers <peter.elmers@yahoo.com> writes:
> 
> > Yuya, thanks for the help; I'll keep playing around with SMTP options to try to get something to work.
> > r? mpm
> 
> You can try the easier pushgate option:
> 
> https://mercurial.selenic.com/wiki/ContributingChanges#Experimental_submission_via_push_gate

Not applicable to hglib.
Sean Farley - July 24, 2015, 6:15 p.m.
Matt Mackall <mpm@selenic.com> writes:

> On Fri, 2015-07-24 at 10:42 -0700, Sean Farley wrote:
>> Peter Elmers <peter.elmers@yahoo.com> writes:
>> 
>> > Yuya, thanks for the help; I'll keep playing around with SMTP options to try to get something to work.
>> > r? mpm
>> 
>> You can try the easier pushgate option:
>> 
>> https://mercurial.selenic.com/wiki/ContributingChanges#Experimental_submission_via_push_gate
>
> Not applicable to hglib.

Ha, derp. Totally missed that. ... Maybe we should create push gates for
hglib and any other repos on selenic?
timeless - July 24, 2015, 9:56 p.m.
fwiw, your email is flagged as spam by gmail (presumably
dkim/dmarc/spf), which means that I'm regularly fishing it out of the
spam folder :(


http://www.pcworld.com/article/2141120/yahoo-email-antispoofing-policy-breaks-mailing-lists.html

On Fri, Jul 24, 2015 at 9:35 AM, Peter Elmers <peter.elmers@yahoo.com> wrote:
> Yuya, thanks for the help; I'll keep playing around with SMTP options to try
> to get something to work.
>  r? mpm
>
>
> On Friday, July 24, 2015 6:11 AM, Yuya Nishihara <yuya@tcha.org> wrote:
>
>
> On Thu, 23 Jul 2015 17:15:33 +0000 (UTC), Peter Elmers wrote:
>> I have updated the commit message. Unfortunately I haven't had any success
>> configuring sendmail to work with my email account;
>
> Did you try an SMTP? It should be much simpler than sendmail.
>
>
>> I have included the patch below as well as in an attachment,
>> but I believe that the whitespace is correct.
>
>
> Well, all leading whitespaces are \xc2\xa0. I can apply it by the following
> command, but that doesn't mean it will be accepted by mpm.
>
>   % xclip -sel clip -out | sed 's/\xc2\xa0/ /g' | hg patch -
>
>
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,12 @@ 
 import os, time
 from distutils.core import setup
 
-# query Mercurial for version number
+# query Mercurial for version number, or pull from PKG-INFO
 version = 'unknown'
 if os.path.isdir('.hg'):
     cmd = "hg id -i -t"
     l = os.popen(cmd).read().split()
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
         l.pop()
     if len(l) > 1: # tag found
         version = l[-1]
@@ -21,16 +21,20 @@  elif os.path.exists('.hg_archival.txt'):
     kw = dict([[t.strip() for t in l.split(':', 1)]
                for l in open('.hg_archival.txt')])
     if 'tag' in kw:
         version =  kw['tag']
     elif 'latesttag' in kw:
         version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
     else:
         version = kw.get('node', '')[:12]
+elif os.path.exists('PKG-INFO'):
+    kw = dict([[t.strip() for t in l.split(':', 1)]
+               for l in open('PKG-INFO') if ':' in l])
+    version = kw.get('Version', version)
 
 setup(
     name='python-hglib',
     version=version,
     author='Idan Kamara',
     author_email='idankk86@gmail.com',
     url='http://selenic.com/repo/python-hglib',
     description='Mercurial Python library',