Skip to content

Commit e7ba350

Browse files
author
Gauvain Pocentek
committed
python 3 support
1 parent c6174e5 commit e7ba350

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ A CLI tool is also provided (called **gitlab**).
88

99
## Requirements
1010

11-
Only Python 2 is supported for the moment.
11+
python-gitlab depends on:
1212

13-
python-gitlab depends on [python-requests](http://docs.python-requests.org/en/latest/).
13+
* [python-requests](http://docs.python-requests.org/en/latest/).
1414

1515
## State
1616

@@ -20,7 +20,6 @@ python-gitlab is a work in progress, although already usable. Changes in the API
2020

2121
* Improve documentation
2222
* Write unit tests
23-
* Improve the command line tool
2423

2524
## Code snippet
2625

gitlab

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
44
# Copyright (C) 2013 Gauvain Pocentek <gauvain@pocentek.net>
@@ -19,7 +19,10 @@
1919
import os
2020
import sys
2121

22-
from ConfigParser import ConfigParser
22+
try:
23+
from ConfigParser import ConfigParser
24+
except:
25+
from configparser import ConfigParser
2326

2427
from inspect import getmro
2528

gitlab.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,21 +486,21 @@ def __str__(self):
486486
return '%s => %s' % (type(self), str(self.__dict__))
487487

488488
def pretty_print(self, depth=0):
489-
print "%sid: %s" % (" " * depth * 2, self.id)
489+
print("%sid: %s" % (" " * depth * 2, self.id))
490490
for k in sorted(self.__dict__.keys()):
491491
if k == "id":
492492
continue
493493
v = self.__dict__[k]
494494
if isinstance(v, GitlabObject):
495495
if depth == 0:
496-
print "%s:" % k
496+
print("%s:" % k)
497497
v.pretty_print(1)
498498
else:
499-
print "%s: %s" % (k, v.id)
499+
print("%s: %s" % (k, v.id))
500500
else:
501501
if isinstance(v, Gitlab):
502502
continue
503-
print "%s%s: %s" % (" " * depth * 2, k, v)
503+
print("%s%s: %s" % (" " * depth * 2, k, v))
504504

505505
def json(self):
506506
return json.dumps(self.__dict__, cls=jsonEncoder)

0 commit comments

Comments
 (0)