Skip to contentSkip to conversation

policycoreutils: fix PEP8 issues

GIT PULL Jason Zaman 3 participants 10 messages Jul 17, 2015 – Jul 24, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

The following changes since commit 2202a68d5ac2ac4c8fe05cdea829435efd2ba8e6:

Updated sepolgen ChangeLog. (2015-07-16 13:11:14 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 78c977e34c85ff97e236434d90ee9be5ed8ce1d0:

policycoreutils: Fix PEP8 issues (2015-07-17 17:55:28 +0400)

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

---- ------------------------------------------------------------ Jason Zaman (1):
policycoreutils: Fix PEP8 issues

 policycoreutils/audit2allow/audit2allow           |  112 ++--
 policycoreutils/audit2allow/audit2why             |  104 ++--
 policycoreutils/audit2allow/sepolgen-ifgen        |   14 +-
 policycoreutils/audit2allow/test_audit2allow.py   |   15 +-
 policycoreutils/gui/booleansPage.py               |   69 ++-
 policycoreutils/gui/domainsPage.py                |   24 +-
 policycoreutils/gui/fcontextPage.py               |   83 +--
 policycoreutils/gui/html_util.py                  |   19 +-
 policycoreutils/gui/loginsPage.py                 |   45 +-
 policycoreutils/gui/mappingsPage.py               |    6 +-
 policycoreutils/gui/modulesPage.py                |   33 +-
 policycoreutils/gui/polgengui.py                  |  201 +++----
 policycoreutils/gui/portsPage.py                  |   48 +-
 policycoreutils/gui/semanagePage.py               |   29 +-
 policycoreutils/gui/statusPage.py                 |   40 +-
 policycoreutils/gui/system-config-selinux.py      |   33 +-
 policycoreutils/gui/usersPage.py                  |   30 +-
 policycoreutils/mcstrans/share/util/mlscolor-test |   18 +-
 policycoreutils/mcstrans/share/util/mlstrans-test |   27 +-
 policycoreutils/sandbox/sandbox                   |  592 +++++++++---------
 policycoreutils/sandbox/start                     |    8 +-
 policycoreutils/sandbox/test_sandbox.py           |   27 +-
 policycoreutils/scripts/chcat                     |  129 ++--
 policycoreutils/semanage/semanage                 |  238 +++++---
 policycoreutils/semanage/seobject.py              | 4316 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------
 policycoreutils/semanage/test-semanage.py         |  291 ++++-----
 policycoreutils/sepolicy/selinux_client.py        |   19 +-
 policycoreutils/sepolicy/selinux_server.py        |   29 +-
 policycoreutils/sepolicy/sepolicy.py              |  220 ++++---
 policycoreutils/sepolicy/sepolicy/__init__.py     |  487 ++++++++-------
 policycoreutils/sepolicy/sepolicy/booleans.py     |   19 +-
 policycoreutils/sepolicy/sepolicy/communicate.py  |   21 +-
 policycoreutils/sepolicy/sepolicy/generate.py     | 2168 +++++++++++++++++++++++++++++++++---------------------------------
 policycoreutils/sepolicy/sepolicy/gui.py          |  527 ++++++++--------
 policycoreutils/sepolicy/sepolicy/interface.py    |   49 +-
 policycoreutils/sepolicy/sepolicy/manpage.py      | 1174 ++++++++++++++++++------------------
 policycoreutils/sepolicy/sepolicy/network.py      |   33 +-
 policycoreutils/sepolicy/sepolicy/sedbus.py       |   30 +-
 policycoreutils/sepolicy/sepolicy/transition.py   |   35 +-
 policycoreutils/sepolicy/setup.py                 |    8 +-
 policycoreutils/sepolicy/test_sepolicy.py         |   39 +-
 41 files changed, 5907 insertions(+), 5502 deletions(-)
#1 lore raw
Quoted 31 lines · Jason Zaman

The following changes since commit 2202a68d5ac2ac4c8fe05cdea829435efd2ba8e6:

Updated sepolgen ChangeLog. (2015-07-16 13:11:14 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 78c977e34c85ff97e236434d90ee9be5ed8ce1d0:

policycoreutils: Fix PEP8 issues (2015-07-17 17:55:28 +0400)

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

Quoted 6 lines

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

If this was generated entirely via autopep8, I'd prefer to take this other patch series first:
http://marc.info/?l=selinux&m=143743932419386&w=2
as it will be easier to redo the autopep8 on top than the other way around.

Quoted 55 lines

---- ------------------------------------------------------------ Jason Zaman (1):
policycoreutils: Fix PEP8 issues

 policycoreutils/audit2allow/audit2allow           |  112 ++--
 policycoreutils/audit2allow/audit2why             |  104 ++--
 policycoreutils/audit2allow/sepolgen-ifgen        |   14 +-
 policycoreutils/audit2allow/test_audit2allow.py   |   15 +-
 policycoreutils/gui/booleansPage.py               |   69 ++-
 policycoreutils/gui/domainsPage.py                |   24 +-
 policycoreutils/gui/fcontextPage.py               |   83 +--
 policycoreutils/gui/html_util.py                  |   19 +-
 policycoreutils/gui/loginsPage.py                 |   45 +-
 policycoreutils/gui/mappingsPage.py               |    6 +-
 policycoreutils/gui/modulesPage.py                |   33 +-
 policycoreutils/gui/polgengui.py                  |  201 +++----
 policycoreutils/gui/portsPage.py                  |   48 +-
 policycoreutils/gui/semanagePage.py               |   29 +-
 policycoreutils/gui/statusPage.py                 |   40 +-
 policycoreutils/gui/system-config-selinux.py      |   33 +-
 policycoreutils/gui/usersPage.py                  |   30 +-
 policycoreutils/mcstrans/share/util/mlscolor-test |   18 +-
 policycoreutils/mcstrans/share/util/mlstrans-test |   27 +-
 policycoreutils/sandbox/sandbox                   |  592 +++++++++---------
 policycoreutils/sandbox/start                     |    8 +-
 policycoreutils/sandbox/test_sandbox.py           |   27 +-
 policycoreutils/scripts/chcat                     |  129 ++--
 policycoreutils/semanage/semanage                 |  238 +++++---
 policycoreutils/semanage/seobject.py              | 4316 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------
 policycoreutils/semanage/test-semanage.py         |  291 ++++-----
 policycoreutils/sepolicy/selinux_client.py        |   19 +-
 policycoreutils/sepolicy/selinux_server.py        |   29 +-
 policycoreutils/sepolicy/sepolicy.py              |  220 ++++---
 policycoreutils/sepolicy/sepolicy/__init__.py     |  487 ++++++++-------
 policycoreutils/sepolicy/sepolicy/booleans.py     |   19 +-
 policycoreutils/sepolicy/sepolicy/communicate.py  |   21 +-
 policycoreutils/sepolicy/sepolicy/generate.py     | 2168 +++++++++++++++++++++++++++++++++---------------------------------
 policycoreutils/sepolicy/sepolicy/gui.py          |  527 ++++++++--------
 policycoreutils/sepolicy/sepolicy/interface.py    |   49 +-
 policycoreutils/sepolicy/sepolicy/manpage.py      | 1174 ++++++++++++++++++------------------
 policycoreutils/sepolicy/sepolicy/network.py      |   33 +-
 policycoreutils/sepolicy/sepolicy/sedbus.py       |   30 +-
 policycoreutils/sepolicy/sepolicy/transition.py   |   35 +-
 policycoreutils/sepolicy/setup.py                 |    8 +-
 policycoreutils/sepolicy/test_sepolicy.py         |   39 +-
 41 files changed, 5907 insertions(+), 5502 deletions(-)

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

#2 lore raw
Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Jason Zaman

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

Quoted 7 lines
Quoted 2 lines

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

If this was generated entirely via autopep8, I'd prefer to take this other patch series first:
http://marc.info/?l=selinux&m=143743932419386&w=2
as it will be easier to redo the autopep8 on top than the other way around.

Yes it was 100% automated, I can re-generate it now that those have been applied or I can wait till a bit later once the semanage.py fixes are in or you could just run it yourself and commit it. which would you prefer?

The important part will be to make sure that all commits afterwards are also following pep8.

-- Jason

#3 lore raw
Quoted 33 lines · Jason Zaman
Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Jason Zaman

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

Quoted 7 lines
Quoted 2 lines

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

If this was generated entirely via autopep8, I'd prefer to take this other patch series first:
http://marc.info/?l=selinux&m=143743932419386&w=2
as it will be easier to redo the autopep8 on top than the other way around.

Quoted 6 lines

Yes it was 100% automated, I can re-generate it now that those have been applied or I can wait till a bit later once the semanage.py fixes are in or you could just run it yourself and commit it. which would you prefer?

The important part will be to make sure that all commits afterwards are also following pep8.

I'll ask if Red Hat has any other patches they care to submit for policycoreutils python code before performing the conversion.

#4 lore raw
Quoted 38 lines · Stephen Smalley
Quoted 37 lines · Jason Zaman
Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Jason Zaman

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

Quoted 7 lines
Quoted 2 lines

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

If this was generated entirely via autopep8, I'd prefer to take this other patch series first:
http://marc.info/?l=selinux&m=143743932419386&w=2
as it will be easier to redo the autopep8 on top than the other way around.

Yes it was 100% automated, I can re-generate it now that those have been applied or I can wait till a bit later once the semanage.py fixes are in or you could just run it yourself and commit it. which would you prefer?

Quoted 7 lines
Quoted 2 lines

The important part will be to make sure that all commits afterwards are also following pep8.

I'll ask if Red Hat has any other patches they care to submit for policycoreutils python code before performing the conversion.

I'm just looking into it.

From the top of my head there should be only one other patch in Fedora which makes a python module seobject/__init__.py from seobject.py for python3. Other changes are either indentation fixes or should be already covered by patches sent by my colleagues few days ago.

I hope I'll provide a relevant patch set today.

Petr

Signature · 1 line
Petr Lautrbach
#5 lore raw
Quoted 47 lines · Petr Lautrbach
Quoted 38 lines · Stephen Smalley
Quoted 37 lines · Jason Zaman
Quoted 24 lines · Stephen Smalley
Quoted 23 lines · Jason Zaman

Commit message:

policycoreutils: Fix PEP8 issues

When trying to get policycoreutils working in python3, I kept running into TabErrors:

Traceback (most recent call last):
File "/usr/lib/python-exec/python3.3/semanage", line 27, in <module>
import seobject
File "/usr/lib64/python3.3/site-packages/seobject.py", line 154
context = "%s%s" % (filler, raw)
^
TabError: inconsistent use of tabs and spaces in indentation

Python3 is a lot stricter than python2 regarding whitespace and looks like previous commits mixed the two. When fixing this, I took the chance to fix other PEP8 style issues at the same time.

This commit was made using:
$ file $(find . -type f) | grep -i python > pyfiles $ autopep8 --in-place --ignore=E501,E265 $(cat pyfiles)

Quoted 7 lines
Quoted 2 lines

The ignore E501 is long lines since there are many that would be wrapped otherwise, and E265 is block comments that start with ## instead of just #.

If this was generated entirely via autopep8, I'd prefer to take this other patch series first:
http://marc.info/?l=selinux&m=143743932419386&w=2
as it will be easier to redo the autopep8 on top than the other way around.

Yes it was 100% automated, I can re-generate it now that those have been applied or I can wait till a bit later once the semanage.py fixes are in or you could just run it yourself and commit it. which would you prefer?

Quoted 7 lines
Quoted 2 lines

The important part will be to make sure that all commits afterwards are also following pep8.

I'll ask if Red Hat has any other patches they care to submit for policycoreutils python code before performing the conversion.

Quoted 8 lines

I'm just looking into it.

From the top of my head there should be only one other patch in Fedora which makes a python module seobject/__init__.py from seobject.py for python3. Other changes are either indentation fixes or should be already covered by patches sent by my colleagues few days ago.

I hope I'll provide a relevant patch set today.

It seems that there's only seobject.py which needs to be ported to python 3. I would start with the indent conversion as it's needed anyway and then we could provide a patch with python 3 support based on this conversion.

Petr

Signature · 1 line
Petr Lautrbach
#6 lore raw
Quoted 4 lines · Petr Lautrbach

It seems that there's only seobject.py which needs to be ported to python 3. I would start with the indent conversion as it's needed anyway and then we could provide a patch with python 3 support based on this conversion.

The following changes since commit d19cda0c80524b57464b3bb74dce1297d017b4b1:

Updated libsepol ChangeLog (2015-07-22 11:02:32 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 789d0ebbf9fa448b09917ccd0adff91d72e9f5c1:

policycoreutils: Fix PEP8 issues (2015-07-24 16:07:13 +0800)

----------------------------------------------------------------
Jason Zaman (1):
policycoreutils: Fix PEP8 issues

I re-did the changes on top of the current master and updated that branch. this is the new commit to pull.

All the files now follow PEP8 style (ie tabs are 4 spaces) so future commits should follow that too.

#7 lore raw
Quoted 23 lines · Jason Zaman
Quoted 4 lines · Petr Lautrbach

It seems that there's only seobject.py which needs to be ported to python 3. I would start with the indent conversion as it's needed anyway and then we could provide a patch with python 3 support based on this conversion.

The following changes since commit d19cda0c80524b57464b3bb74dce1297d017b4b1:

Updated libsepol ChangeLog (2015-07-22 11:02:32 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 789d0ebbf9fa448b09917ccd0adff91d72e9f5c1:

policycoreutils: Fix PEP8 issues (2015-07-24 16:07:13 +0800)

----------------------------------------------------------------
Jason Zaman (1):
policycoreutils: Fix PEP8 issues

Quoted 5 lines

I re-did the changes on top of the current master and updated that branch. this is the new commit to pull.

All the files now follow PEP8 style (ie tabs are 4 spaces) so future commits should follow that too.

After seobject.py is converted, I see a few issues with policycoreutils/sepolicy/sepolicy/*.

The easy stuff 2to3 handles, but it looks like there will need to be some changes to the C module, I've got it building by adding some #defines for PyInt_AsLong and the like. I am not that familiar with the C-Python stuff so it might not be done the right way.

-- Jason

#8 lore raw
Quoted 30 lines · Jason Zaman
Quoted 23 lines · Jason Zaman
Quoted 4 lines · Petr Lautrbach

It seems that there's only seobject.py which needs to be ported to python 3. I would start with the indent conversion as it's needed anyway and then we could provide a patch with python 3 support based on this conversion.

The following changes since commit d19cda0c80524b57464b3bb74dce1297d017b4b1:

Updated libsepol ChangeLog (2015-07-22 11:02:32 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 789d0ebbf9fa448b09917ccd0adff91d72e9f5c1:

policycoreutils: Fix PEP8 issues (2015-07-24 16:07:13 +0800)

----------------------------------------------------------------
Jason Zaman (1):
policycoreutils: Fix PEP8 issues

Quoted 5 lines

I re-did the changes on top of the current master and updated that branch. this is the new commit to pull.

All the files now follow PEP8 style (ie tabs are 4 spaces) so future commits should follow that too.

Quoted 7 lines

After seobject.py is converted, I see a few issues with policycoreutils/sepolicy/sepolicy/*.

The easy stuff 2to3 handles, but it looks like there will need to be some changes to the C module, I've got it building by adding some #defines for PyInt_AsLong and the like. I am not that familiar with the C-Python stuff so it might not be done the right way.

On this, we would prefer to see policycoreutils/sepolicy converted to use setools4, which directly provides python interfaces, no C extension required. setools3 is no longer maintained.

#9 lore raw
In reply to Jason Zaman
Quoted 23 lines · Jason Zaman
Quoted 4 lines · Petr Lautrbach

It seems that there's only seobject.py which needs to be ported to python 3. I would start with the indent conversion as it's needed anyway and then we could provide a patch with python 3 support based on this conversion.

The following changes since commit d19cda0c80524b57464b3bb74dce1297d017b4b1:

Updated libsepol ChangeLog (2015-07-22 11:02:32 -0400)

are available in the git repository at:

https://github.com/perfinion/selinux.git reformat

for you to fetch changes up to 789d0ebbf9fa448b09917ccd0adff91d72e9f5c1:

policycoreutils: Fix PEP8 issues (2015-07-24 16:07:13 +0800)

----------------------------------------------------------------
Jason Zaman (1):
policycoreutils: Fix PEP8 issues

Quoted 5 lines

I re-did the changes on top of the current master and updated that branch. this is the new commit to pull.

All the files now follow PEP8 style (ie tabs are 4 spaces) so future commits should follow that too.

Thanks, pulled.