You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@steve.apache.org by Greg Stein <gs...@gmail.com> on 2013/06/02 23:08:35 UTC

Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Per Alan's wanting to do some Python work... anybody have any problem
with [the project] converting the Perl scripts over to Python?

While I can manage some Perl with perlman in front of me, I think
we're all more comfortable with Python. We have 1492 lines of Perl.
Looking at the long (make_issue.pl), it is more text than code. We
should be able to port the scripts over one at a time.

(and note that wrapsuid.c is agnostic about the target program)

I'm also thinking we could write a ./configure script in Python.
Normally, it is shell, but if Steve requires Python, then I see no
problem with configure being in Python. (specifically, I'm looking at
grp.getgrnam() (and similar for user id) to map a human name to an ID,
rather than hard-coding in Makefile)

Cheers,
-g


On Wed, May 29, 2013 at 3:35 PM,  <ji...@apache.org> wrote:
> Author: jim
> Date: Wed May 29 19:35:26 2013
> New Revision: 1487609
>
> URL: http://svn.apache.org/r1487609
> Log:
> Lump all Steve subs into steve.pm
>
> Removed:
>     steve/trunk/cmdline/ballots.pm
>     steve/trunk/cmdline/randomize.pm
> Modified:
>     steve/trunk/cmdline/make_issue.pl
>     steve/trunk/cmdline/reminder.pl
>     steve/trunk/cmdline/steve.pm
>
> Modified: steve/trunk/cmdline/make_issue.pl
> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/make_issue.pl?rev=1487609&r1=1487608&r2=1487609&view=diff
> ==============================================================================
> --- steve/trunk/cmdline/make_issue.pl (original)
> +++ steve/trunk/cmdline/make_issue.pl Wed May 29 19:35:26 2013
> @@ -38,8 +38,6 @@ BEGIN {
>      unshift @INC, "/home/voter/bin";
>  }
>  require "getopts.pl";
> -use randomize;
> -use ballots;
>  use steve;
>
>  umask(0077);
>
> Modified: steve/trunk/cmdline/reminder.pl
> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/reminder.pl?rev=1487609&r1=1487608&r2=1487609&view=diff
> ==============================================================================
> --- steve/trunk/cmdline/reminder.pl (original)
> +++ steve/trunk/cmdline/reminder.pl Wed May 29 19:35:26 2013
> @@ -26,7 +26,6 @@
>  BEGIN {
>      unshift @INC, "/home/voter/bin";
>  }
> -use randomize;
>  use steve;
>
>
>
> Modified: steve/trunk/cmdline/steve.pm
> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/steve.pm?rev=1487609&r1=1487608&r2=1487609&view=diff
> ==============================================================================
> --- steve/trunk/cmdline/steve.pm (original)
> +++ steve/trunk/cmdline/steve.pm Wed May 29 19:35:26 2013
> @@ -19,6 +19,8 @@
>  # shared functions for Apache Steve.
>  #
>
> +##use strict;
> +
>  $ECHO     = '/bin/echo';
>  $CAT      = '/bin/cat';
>  $MD5      = '/sbin/md5';
> @@ -204,4 +206,42 @@ sub not_valid {
>    return 0;
>  }
>
> +# randomize the order in which candidates are listed
> +#
> +# candidates are identified with a single alphanumeric character surrounded
> +# by square brackets as the first non-blank on a line.
> +#
> +# candidates are to be listed consecutively, one per line.  If this is
> +# found not to be the case, NO reordering is performed.
> +sub randomize {
> +  my (@prolog, @choices, @epilog);
> +
> +  push @prolog, shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
> +  unshift @epilog, pop while @_ && not $_[-1] =~ /^\s*\[[a-z0-9]\]\s/;
> +  return @prolog, @_, @epilog if grep !/^\s*\[\S\]\s/, @_;
> +  push @choices, splice(@_, rand @_, 1) while @_;
> +  return @prolog, @choices, @epilog;
> +}
> +
> +# return the ballot identifiers for each candidate in an issue.
> +#
> +# candidates are identified with a single alphanumeric character surrounded
> +# by square brackets as the first non-blank on a line.
> +#
> +# candidates are to be listed consecutively, one per line.
> +#
> +sub ballots {
> +  my (@ballots);
> +
> +  shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
> +  for (@_) {
> +    if (/^\s*\[([a-z0-9])\]\s/) {
> +      push @ballots, "$1\n";
> +    } else {
> +      last;
> +    }
> +  }
> +  return @ballots;
> +}
> +
>  1;
>
>

Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Posted by "Mattmann, Chris A (398J)" <ch...@jpl.nasa.gov>.
yay for PIP!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.a.mattmann@nasa.gov
WWW:  http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






-----Original Message-----
From: Greg Stein <gs...@gmail.com>
Reply-To: "dev@steve.apache.org" <de...@steve.apache.org>
Date: Sunday, June 2, 2013 8:49 PM
To: "dev@steve.apache.org" <de...@steve.apache.org>
Subject: Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm
make_issue.pl randomize.pm reminder.pl steve.pm

>On Sun, Jun 2, 2013 at 11:46 PM, Alan Cabrera <li...@toolazydogs.com>
>wrote:
>> On Jun 2, 2013, at 2:08 PM, Greg Stein <gs...@gmail.com> wrote:
>>> Per Alan's wanting to do some Python work... anybody have any problem
>>> with [the project] converting the Perl scripts over to Python?
>>...
>> +1 for Python
>>
>> IMO, we should structure it like a standard Python project w/ setup.py,
>>etc.
>
>Agreed. And upload it to PIP.
>
>(I hate distutils, but have learned to hold my nose and deal with it)
>
>Cheers,
>-g


Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Posted by Greg Stein <gs...@gmail.com>.
On Sun, Jun 2, 2013 at 11:46 PM, Alan Cabrera <li...@toolazydogs.com> wrote:
> On Jun 2, 2013, at 2:08 PM, Greg Stein <gs...@gmail.com> wrote:
>> Per Alan's wanting to do some Python work... anybody have any problem
>> with [the project] converting the Perl scripts over to Python?
>...
> +1 for Python
>
> IMO, we should structure it like a standard Python project w/ setup.py, etc.

Agreed. And upload it to PIP.

(I hate distutils, but have learned to hold my nose and deal with it)

Cheers,
-g

Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Posted by Alan Cabrera <li...@toolazydogs.com>.
On Jun 2, 2013, at 2:08 PM, Greg Stein <gs...@gmail.com> wrote:

> Per Alan's wanting to do some Python work... anybody have any problem
> with [the project] converting the Perl scripts over to Python?
> 
> While I can manage some Perl with perlman in front of me, I think
> we're all more comfortable with Python. We have 1492 lines of Perl.
> Looking at the long (make_issue.pl), it is more text than code. We
> should be able to port the scripts over one at a time.
> 
> (and note that wrapsuid.c is agnostic about the target program)
> 
> I'm also thinking we could write a ./configure script in Python.
> Normally, it is shell, but if Steve requires Python, then I see no
> problem with configure being in Python. (specifically, I'm looking at
> grp.getgrnam() (and similar for user id) to map a human name to an ID,
> rather than hard-coding in Makefile)

+1 for Python

IMO, we should structure it like a standard Python project w/ setup.py, etc.


Regards,
Alan


Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Posted by Jim Jagielski <ji...@jaguNET.com>.
+1
On Jun 2, 2013, at 5:08 PM, Greg Stein <gs...@gmail.com> wrote:

> Per Alan's wanting to do some Python work... anybody have any problem
> with [the project] converting the Perl scripts over to Python?
> 
> While I can manage some Perl with perlman in front of me, I think
> we're all more comfortable with Python. We have 1492 lines of Perl.
> Looking at the long (make_issue.pl), it is more text than code. We
> should be able to port the scripts over one at a time.
> 
> (and note that wrapsuid.c is agnostic about the target program)
> 
> I'm also thinking we could write a ./configure script in Python.
> Normally, it is shell, but if Steve requires Python, then I see no
> problem with configure being in Python. (specifically, I'm looking at
> grp.getgrnam() (and similar for user id) to map a human name to an ID,
> rather than hard-coding in Makefile)
> 
> Cheers,
> -g
> 
> 
> On Wed, May 29, 2013 at 3:35 PM,  <ji...@apache.org> wrote:
>> Author: jim
>> Date: Wed May 29 19:35:26 2013
>> New Revision: 1487609
>> 
>> URL: http://svn.apache.org/r1487609
>> Log:
>> Lump all Steve subs into steve.pm
>> 
>> Removed:
>>    steve/trunk/cmdline/ballots.pm
>>    steve/trunk/cmdline/randomize.pm
>> Modified:
>>    steve/trunk/cmdline/make_issue.pl
>>    steve/trunk/cmdline/reminder.pl
>>    steve/trunk/cmdline/steve.pm
>> 
>> Modified: steve/trunk/cmdline/make_issue.pl
>> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/make_issue.pl?rev=1487609&r1=1487608&r2=1487609&view=diff
>> ==============================================================================
>> --- steve/trunk/cmdline/make_issue.pl (original)
>> +++ steve/trunk/cmdline/make_issue.pl Wed May 29 19:35:26 2013
>> @@ -38,8 +38,6 @@ BEGIN {
>>     unshift @INC, "/home/voter/bin";
>> }
>> require "getopts.pl";
>> -use randomize;
>> -use ballots;
>> use steve;
>> 
>> umask(0077);
>> 
>> Modified: steve/trunk/cmdline/reminder.pl
>> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/reminder.pl?rev=1487609&r1=1487608&r2=1487609&view=diff
>> ==============================================================================
>> --- steve/trunk/cmdline/reminder.pl (original)
>> +++ steve/trunk/cmdline/reminder.pl Wed May 29 19:35:26 2013
>> @@ -26,7 +26,6 @@
>> BEGIN {
>>     unshift @INC, "/home/voter/bin";
>> }
>> -use randomize;
>> use steve;
>> 
>> 
>> 
>> Modified: steve/trunk/cmdline/steve.pm
>> URL: http://svn.apache.org/viewvc/steve/trunk/cmdline/steve.pm?rev=1487609&r1=1487608&r2=1487609&view=diff
>> ==============================================================================
>> --- steve/trunk/cmdline/steve.pm (original)
>> +++ steve/trunk/cmdline/steve.pm Wed May 29 19:35:26 2013
>> @@ -19,6 +19,8 @@
>> # shared functions for Apache Steve.
>> #
>> 
>> +##use strict;
>> +
>> $ECHO     = '/bin/echo';
>> $CAT      = '/bin/cat';
>> $MD5      = '/sbin/md5';
>> @@ -204,4 +206,42 @@ sub not_valid {
>>   return 0;
>> }
>> 
>> +# randomize the order in which candidates are listed
>> +#
>> +# candidates are identified with a single alphanumeric character surrounded
>> +# by square brackets as the first non-blank on a line.
>> +#
>> +# candidates are to be listed consecutively, one per line.  If this is
>> +# found not to be the case, NO reordering is performed.
>> +sub randomize {
>> +  my (@prolog, @choices, @epilog);
>> +
>> +  push @prolog, shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
>> +  unshift @epilog, pop while @_ && not $_[-1] =~ /^\s*\[[a-z0-9]\]\s/;
>> +  return @prolog, @_, @epilog if grep !/^\s*\[\S\]\s/, @_;
>> +  push @choices, splice(@_, rand @_, 1) while @_;
>> +  return @prolog, @choices, @epilog;
>> +}
>> +
>> +# return the ballot identifiers for each candidate in an issue.
>> +#
>> +# candidates are identified with a single alphanumeric character surrounded
>> +# by square brackets as the first non-blank on a line.
>> +#
>> +# candidates are to be listed consecutively, one per line.
>> +#
>> +sub ballots {
>> +  my (@ballots);
>> +
>> +  shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
>> +  for (@_) {
>> +    if (/^\s*\[([a-z0-9])\]\s/) {
>> +      push @ballots, "$1\n";
>> +    } else {
>> +      last;
>> +    }
>> +  }
>> +  return @ballots;
>> +}
>> +
>> 1;
>> 
>> 
> 


Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm make_issue.pl randomize.pm reminder.pl steve.pm

Posted by "Mattmann, Chris A (398J)" <ch...@jpl.nasa.gov>.
+1 on Python -- I need to take some time to take a look at the Perl
code. I used Perl way back when so will have to get up on my shifts
and such :)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.a.mattmann@nasa.gov
WWW:  http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






-----Original Message-----
From: Greg Stein <gs...@gmail.com>
Reply-To: "dev@steve.apache.org" <de...@steve.apache.org>
Date: Sunday, June 2, 2013 2:08 PM
To: "dev@steve.apache.org" <de...@steve.apache.org>
Subject: Re: svn commit: r1487609 - in /steve/trunk/cmdline: ballots.pm
make_issue.pl randomize.pm reminder.pl steve.pm

>Per Alan's wanting to do some Python work... anybody have any problem
>with [the project] converting the Perl scripts over to Python?
>
>While I can manage some Perl with perlman in front of me, I think
>we're all more comfortable with Python. We have 1492 lines of Perl.
>Looking at the long (make_issue.pl), it is more text than code. We
>should be able to port the scripts over one at a time.
>
>(and note that wrapsuid.c is agnostic about the target program)
>
>I'm also thinking we could write a ./configure script in Python.
>Normally, it is shell, but if Steve requires Python, then I see no
>problem with configure being in Python. (specifically, I'm looking at
>grp.getgrnam() (and similar for user id) to map a human name to an ID,
>rather than hard-coding in Makefile)
>
>Cheers,
>-g
>
>
>On Wed, May 29, 2013 at 3:35 PM,  <ji...@apache.org> wrote:
>> Author: jim
>> Date: Wed May 29 19:35:26 2013
>> New Revision: 1487609
>>
>> URL: http://svn.apache.org/r1487609
>> Log:
>> Lump all Steve subs into steve.pm
>>
>> Removed:
>>     steve/trunk/cmdline/ballots.pm
>>     steve/trunk/cmdline/randomize.pm
>> Modified:
>>     steve/trunk/cmdline/make_issue.pl
>>     steve/trunk/cmdline/reminder.pl
>>     steve/trunk/cmdline/steve.pm
>>
>> Modified: steve/trunk/cmdline/make_issue.pl
>> URL: 
>>http://svn.apache.org/viewvc/steve/trunk/cmdline/make_issue.pl?rev=148760
>>9&r1=1487608&r2=1487609&view=diff
>> 
>>=========================================================================
>>=====
>> --- steve/trunk/cmdline/make_issue.pl (original)
>> +++ steve/trunk/cmdline/make_issue.pl Wed May 29 19:35:26 2013
>> @@ -38,8 +38,6 @@ BEGIN {
>>      unshift @INC, "/home/voter/bin";
>>  }
>>  require "getopts.pl";
>> -use randomize;
>> -use ballots;
>>  use steve;
>>
>>  umask(0077);
>>
>> Modified: steve/trunk/cmdline/reminder.pl
>> URL: 
>>http://svn.apache.org/viewvc/steve/trunk/cmdline/reminder.pl?rev=1487609&
>>r1=1487608&r2=1487609&view=diff
>> 
>>=========================================================================
>>=====
>> --- steve/trunk/cmdline/reminder.pl (original)
>> +++ steve/trunk/cmdline/reminder.pl Wed May 29 19:35:26 2013
>> @@ -26,7 +26,6 @@
>>  BEGIN {
>>      unshift @INC, "/home/voter/bin";
>>  }
>> -use randomize;
>>  use steve;
>>
>>
>>
>> Modified: steve/trunk/cmdline/steve.pm
>> URL: 
>>http://svn.apache.org/viewvc/steve/trunk/cmdline/steve.pm?rev=1487609&r1=
>>1487608&r2=1487609&view=diff
>> 
>>=========================================================================
>>=====
>> --- steve/trunk/cmdline/steve.pm (original)
>> +++ steve/trunk/cmdline/steve.pm Wed May 29 19:35:26 2013
>> @@ -19,6 +19,8 @@
>>  # shared functions for Apache Steve.
>>  #
>>
>> +##use strict;
>> +
>>  $ECHO     = '/bin/echo';
>>  $CAT      = '/bin/cat';
>>  $MD5      = '/sbin/md5';
>> @@ -204,4 +206,42 @@ sub not_valid {
>>    return 0;
>>  }
>>
>> +# randomize the order in which candidates are listed
>> +#
>> +# candidates are identified with a single alphanumeric character
>>surrounded
>> +# by square brackets as the first non-blank on a line.
>> +#
>> +# candidates are to be listed consecutively, one per line.  If this is
>> +# found not to be the case, NO reordering is performed.
>> +sub randomize {
>> +  my (@prolog, @choices, @epilog);
>> +
>> +  push @prolog, shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
>> +  unshift @epilog, pop while @_ && not $_[-1] =~ /^\s*\[[a-z0-9]\]\s/;
>> +  return @prolog, @_, @epilog if grep !/^\s*\[\S\]\s/, @_;
>> +  push @choices, splice(@_, rand @_, 1) while @_;
>> +  return @prolog, @choices, @epilog;
>> +}
>> +
>> +# return the ballot identifiers for each candidate in an issue.
>> +#
>> +# candidates are identified with a single alphanumeric character
>>surrounded
>> +# by square brackets as the first non-blank on a line.
>> +#
>> +# candidates are to be listed consecutively, one per line.
>> +#
>> +sub ballots {
>> +  my (@ballots);
>> +
>> +  shift  while @_ && not $_[0]  =~ /^\s*\[[a-z0-9]\]\s/;
>> +  for (@_) {
>> +    if (/^\s*\[([a-z0-9])\]\s/) {
>> +      push @ballots, "$1\n";
>> +    } else {
>> +      last;
>> +    }
>> +  }
>> +  return @ballots;
>> +}
>> +
>>  1;
>>
>>