summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst7
-rw-r--r--docs/cli.rst5
-rw-r--r--docs/gl_objects/access_requests.rst4
-rw-r--r--docs/gl_objects/groups.rst2
-rw-r--r--docs/gl_objects/projects.rst2
-rw-r--r--docs/gl_objects/protected_branches.rst2
-rw-r--r--gitlab/cli.py6
-rw-r--r--gitlab/const.py3
-rw-r--r--gitlab/v4/cli.py22
9 files changed, 40 insertions, 13 deletions
diff --git a/README.rst b/README.rst
index f4a9357..a0b1825 100644
--- a/README.rst
+++ b/README.rst
@@ -75,6 +75,13 @@ Documentation
The full documentation for CLI and API is available on `readthedocs
<http://python-gitlab.readthedocs.org/en/stable/>`_.
+Build the docs
+--------------
+You can build the documentation using ``sphinx``::
+
+ pip install sphinx
+ python setup.py build_sphinx
+
Contributing
============
diff --git a/docs/cli.rst b/docs/cli.rst
index 220f079..2051d03 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -157,6 +157,11 @@ These options must be defined before the mandatory arguments.
``--output``, ``-o``
Output format. Defaults to a custom format. Can also be ``yaml`` or ``json``.
+ **Notice:**
+
+ The `PyYAML package <https://pypi.org/project/PyYAML/>`_ is required to use the yaml output option.
+ You need to install it separately using ``pip install PyYAML``
+
``--fields``, ``-f``
Comma-separated list of fields to display (``yaml`` and ``json`` output
formats only). If not used, all the object fields are displayed.
diff --git a/docs/gl_objects/access_requests.rst b/docs/gl_objects/access_requests.rst
index 9a147c1..e890ce0 100644
--- a/docs/gl_objects/access_requests.rst
+++ b/docs/gl_objects/access_requests.rst
@@ -10,7 +10,7 @@ following constants are provided to represent the access levels:
* ``gitlab.GUEST_ACCESS``: ``10``
* ``gitlab.REPORTER_ACCESS``: ``20``
* ``gitlab.DEVELOPER_ACCESS``: ``30``
-* ``gitlab.MASTER_ACCESS``: ``40``
+* ``gitlab.MAINTAINER_ACCESS``: ``40``
* ``gitlab.OWNER_ACCESS``: ``50``
References
@@ -43,7 +43,7 @@ Create an access request::
Approve an access request::
ar.approve() # defaults to DEVELOPER level
- ar.approve(access_level=gitlab.MASTER_ACCESS) # explicitly set access level
+ ar.approve(access_level=gitlab.MAINTAINER_ACCESS) # explicitly set access level
Deny (delete) an access request::
diff --git a/docs/gl_objects/groups.rst b/docs/gl_objects/groups.rst
index ff45c9b..0593672 100644
--- a/docs/gl_objects/groups.rst
+++ b/docs/gl_objects/groups.rst
@@ -142,7 +142,7 @@ The following constants define the supported access levels:
* ``gitlab.GUEST_ACCESS = 10``
* ``gitlab.REPORTER_ACCESS = 20``
* ``gitlab.DEVELOPER_ACCESS = 30``
-* ``gitlab.MASTER_ACCESS = 40``
+* ``gitlab.MAINTAINER_ACCESS = 40``
* ``gitlab.OWNER_ACCESS = 50``
Reference
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index dd444bf..276686c 100644
--- a/docs/gl_objects/projects.rst
+++ b/docs/gl_objects/projects.rst
@@ -493,7 +493,7 @@ Add a project member::
Modify a project member (change the access level)::
- member.access_level = gitlab.MASTER_ACCESS
+ member.access_level = gitlab.MAINTAINER_ACCESS
member.save()
Remove a member from the project team::
diff --git a/docs/gl_objects/protected_branches.rst b/docs/gl_objects/protected_branches.rst
index bd2b22b..f0479e0 100644
--- a/docs/gl_objects/protected_branches.rst
+++ b/docs/gl_objects/protected_branches.rst
@@ -32,7 +32,7 @@ Create a protected branch::
p_branch = project.protectedbranches.create({
'name': '*-stable',
'merge_access_level': gitlab.DEVELOPER_ACCESS,
- 'push_access_level': gitlab.MASTER_ACCESS
+ 'push_access_level': gitlab.MAINTAINER_ACCESS
})
Delete a protected branch::
diff --git a/gitlab/cli.py b/gitlab/cli.py
index 4870192..e79ac6d 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -98,7 +98,7 @@ def _get_base_parser(add_help=True):
"will be used."),
required=False)
parser.add_argument("-o", "--output",
- help=("Output format (v4 only): json|legacy|yaml"),
+ help="Output format (v4 only): json|legacy|yaml",
required=False,
choices=['json', 'legacy', 'yaml'],
default="legacy")
@@ -135,6 +135,10 @@ def main():
exit(0)
parser = _get_base_parser(add_help=False)
+ if "--help" in sys.argv or "-h" in sys.argv:
+ parser.print_help()
+ exit(0)
+
# This first parsing step is used to find the gitlab config to use, and
# load the propermodule (v3 or v4) accordingly. At that point we don't have
# any subparser setup
diff --git a/gitlab/const.py b/gitlab/const.py
index e4766d5..62f2403 100644
--- a/gitlab/const.py
+++ b/gitlab/const.py
@@ -18,7 +18,8 @@
GUEST_ACCESS = 10
REPORTER_ACCESS = 20
DEVELOPER_ACCESS = 30
-MASTER_ACCESS = 40
+MAINTAINER_ACCESS = 40
+MASTER_ACCESS = MAINTAINER_ACCESS
OWNER_ACCESS = 50
VISIBILITY_PRIVATE = 0
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index a876f9e..242874d 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -302,14 +302,24 @@ class JSONPrinter(object):
class YAMLPrinter(object):
def display(self, d, **kwargs):
- import yaml # noqa
- print(yaml.safe_dump(d, default_flow_style=False))
+ try:
+ import yaml # noqa
+ print(yaml.safe_dump(d, default_flow_style=False))
+ except ImportError:
+ exit("PyYaml is not installed.\n"
+ "Install it with `pip install PyYaml` "
+ "to use the yaml output feature")
def display_list(self, data, fields, **kwargs):
- import yaml # noqa
- print(yaml.safe_dump(
- [get_dict(obj, fields) for obj in data],
- default_flow_style=False))
+ try:
+ import yaml # noqa
+ print(yaml.safe_dump(
+ [get_dict(obj, fields) for obj in data],
+ default_flow_style=False))
+ except ImportError:
+ exit("PyYaml is not installed.\n"
+ "Install it with `pip install PyYaml` "
+ "to use the yaml output feature")
class LegacyPrinter(object):