All of lore.kernel.org
 help / color / mirror / Atom feed
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH] Make scripts compatible with Python 3
Date: Thu, 27 Mar 2014 12:44:17 -0400	[thread overview]
Message-ID: <53345561.207@tresys.com> (raw)
In-Reply-To: <CAJfZ7=mzDMC2xYHU53Fd=9q9RnPzfCB=Laohg8hbuu-L_=r2aA@mail.gmail.com>

On 03/27/2014 09:40 AM, Nicolas Iooss wrote:
> 2014-03-23 22:05 GMT+01:00 Nicolas Iooss <nicolas.iooss@m4x.org>:
>> Here are all the changes which are needed to make the scripts compatible with
>> Python 3 while keeping compatibility with Python 2.6 and 2.7:
>>
>> * use subprocess module instead of commands,
> 
> I've learnt today that Python 2 doesn't have
> subprocess.getstatusoutput function even though the commands module is
> deprecated [1] and Python 3 provides it without documenting "New in
> python 3" [2] :( I haven't tested building the monolithic policy with
> Python 2 after my patch so it didn't occurred to me that this specific
> config is broken. I think it's best to cancel at least the
> support/genhomedircon part of this patch for now.
> 
> Looking at that, is there any reason why support/genhomedircon uses
> lines like this instead of opening the file with open() and parsing
> the file with Python code?
> 
>     rc=commands.getstatusoutput("grep \"^/\" %s | cut -f 1 | cut -f 1
> -d \" \" " %  (sys.argv[2]) )
> 
> I believe that every "commands.getstatusoutput" call can be replaced
> by pure Python code. I'll send a patch soon (maybe a few days) which
> does exactly this, if it's possible and if nobody tells me I'm wrong
> in doing that.

I wouldn't worry about that script.  We kept it around to work on RHEL4 systems.  That OS has been end of life for a while, so I'll probably remove the RHEL4 refpolicy stuff very soon.


-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

      reply	other threads:[~2014-03-27 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 21:05 [refpolicy] [PATCH] Make scripts compatible with Python 3 Nicolas Iooss
2014-03-27 13:40 ` Nicolas Iooss
2014-03-27 16:44   ` Christopher J. PeBenito [this message]

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=53345561.207@tresys.com \
    --to=cpebenito@tresys.com \
    --cc=refpolicy@oss.tresys.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.