Skip to content

Commit

Permalink
Added python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
retr0h committed Mar 30, 2017
1 parent 32aae01 commit 186e9eb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 4 additions & 2 deletions gilt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

from __future__ import print_function

import contextlib
import errno
import os
Expand All @@ -32,12 +34,12 @@

def print_info(msg):
""" Print the given message to STDOUT. """
print msg
print(msg)


def print_warn(msg):
""" Print the given message to STDOUT in YELLOW. """
print '{}{}'.format(colorama.Fore.YELLOW, msg)
print('{}{}'.format(colorama.Fore.YELLOW, msg))


def run_command(cmd, debug=False):
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ classifier =
Operating System :: OS Independent
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Topic :: System :: Systems Administration
Topic :: Utilities

Expand Down
4 changes: 3 additions & 1 deletion test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ def test_makedirs(temp_dir):

d = os.path.join(temp_dir.strpath, 'foo')
assert os.path.isdir(d)
assert '0755' == oct(os.lstat(d).st_mode & 0777)

expected = (7 * 64 + 5 * 8 + 5) # Octal 755
assert expected == (os.lstat(d).st_mode & 0o777)


def test_makedirs_nested_directory(temp_dir):
Expand Down
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
[tox]
minversion = 1.8
envlist = syntax,py27,doc
envlist =
py{27,36}-unit
py{27,36}-lint
doc
format

[testenv]
passenv = *
deps =
-rrequirements.txt
-rtest-requirements.txt
commands =
py.test --runslow test/ --cov=gilt {posargs}
unit: py.test --runslow -vv --cov-report=term-missing --cov={toxinidir}/gilt/ --no-cov-on-fail {posargs}
lint: flake8

[testenv:syntax]
[testenv:format]
deps =
flake8
yapf
commands =
yapf -i -r gilt/ test/
flake8

[testenv:doc]
passenv = *
Expand Down

0 comments on commit 186e9eb

Please sign in to comment.