cgitize 6.0.4__tar.gz → 7.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cgitize-6.0.4 → cgitize-7.0.0}/.github/workflows/ci.yml +4 -5
- cgitize-7.0.0/.pylintrc +14 -0
- cgitize-7.0.0/.python-version +1 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/PKG-INFO +2 -3
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/bitbucket.py +3 -3
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/config.py +20 -9
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/github.py +14 -4
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/gitlab.py +4 -3
- cgitize-7.0.0/cgitize/header.py +18 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/main.py +2 -15
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/repo.py +53 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/PKG-INFO +2 -3
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/SOURCES.txt +1 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/Dockerfile +1 -1
- {cgitize-6.0.4 → cgitize-7.0.0}/examples/cgitize.toml +12 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/pyproject.toml +5 -3
- {cgitize-6.0.4 → cgitize-7.0.0}/requirements.txt +4 -4
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/example/test.sh +53 -6
- {cgitize-6.0.4 → cgitize-7.0.0}/test/unit/test_bitbucket.py +4 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/unit/test_github.py +2 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/unit/test_gitlab.py +2 -0
- cgitize-6.0.4/.pylintrc +0 -3
- cgitize-6.0.4/.python-version +0 -1
- {cgitize-6.0.4 → cgitize-7.0.0}/.dockerignore +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/.gitattributes +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/.github/dependabot.yml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/.github/workflows/maintenance.yml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/.gitignore +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/DEVELOPMENT.md +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/LICENSE.txt +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/Makefile +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/README.md +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/__init__.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/cgit.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/git.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/utils.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize/version.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/dependency_links.txt +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/entry_points.txt +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/requires.txt +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/cgitize.egg-info/top_level.txt +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/README.md +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/cgitize.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/Dockerfile +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/cmd.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/etc/cgit/common +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/etc/cgitrc +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/etc/nginx/conf.d/default.conf +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/usr/lib/cgit/filters/about-formatting.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/usr/lib/cgit/filters/html-converters/.gitattributes +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/usr/lib/cgit/filters/html-converters/md2html +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/get_output_dir.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker/in_cron.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docker-compose.yml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docs/api.md +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/docs/auth.md +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/examples/docker/cgitize.toml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/prelude.mk +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/setup.cfg +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/__init__.py +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/.dockerignore +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/cgitize/.gitignore +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/cgitize/etc/cgitize.toml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/docker-compose.yml +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/git_server/Dockerfile +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/git_server/setup_repo.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/docker/test.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/integration/local/test.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/set_credentials.sh +0 -0
- {cgitize-6.0.4 → cgitize-7.0.0}/test/unit/__init__.py +0 -0
|
@@ -21,7 +21,6 @@ jobs:
|
|
|
21
21
|
uses: psf/black@stable
|
|
22
22
|
|
|
23
23
|
test_local:
|
|
24
|
-
needs: [lint]
|
|
25
24
|
runs-on: ubuntu-latest
|
|
26
25
|
strategy:
|
|
27
26
|
matrix:
|
|
@@ -33,7 +32,7 @@ jobs:
|
|
|
33
32
|
CGITIZE_BITBUCKET_USERNAME: cgitize-test
|
|
34
33
|
CGITIZE_BITBUCKET_TOKEN: '${{ secrets.CGITIZE_BITBUCKET_TOKEN }}'
|
|
35
34
|
CGITIZE_GITLAB_USERNAME: cgitize-test
|
|
36
|
-
CGITIZE_GITLAB_TOKEN: '${{ secrets.CGITIZE_GITLAB_TOKEN}}'
|
|
35
|
+
CGITIZE_GITLAB_TOKEN: '${{ secrets.CGITIZE_GITLAB_TOKEN }}'
|
|
37
36
|
steps:
|
|
38
37
|
- name: Checkout
|
|
39
38
|
uses: actions/checkout@v6
|
|
@@ -70,7 +69,7 @@ jobs:
|
|
|
70
69
|
CGITIZE_BITBUCKET_USERNAME: cgitize-test
|
|
71
70
|
CGITIZE_BITBUCKET_TOKEN: '${{ secrets.CGITIZE_BITBUCKET_TOKEN }}'
|
|
72
71
|
CGITIZE_GITLAB_USERNAME: cgitize-test
|
|
73
|
-
CGITIZE_GITLAB_TOKEN: '${{ secrets.CGITIZE_GITLAB_TOKEN}}'
|
|
72
|
+
CGITIZE_GITLAB_TOKEN: '${{ secrets.CGITIZE_GITLAB_TOKEN }}'
|
|
74
73
|
steps:
|
|
75
74
|
- name: Checkout
|
|
76
75
|
uses: actions/checkout@v6
|
|
@@ -88,7 +87,7 @@ jobs:
|
|
|
88
87
|
run: make test/example
|
|
89
88
|
|
|
90
89
|
publish_docker:
|
|
91
|
-
needs: [test_local, test_example_config, test_docker]
|
|
90
|
+
needs: [lint, test_local, test_example_config, test_docker]
|
|
92
91
|
runs-on: ubuntu-latest
|
|
93
92
|
strategy:
|
|
94
93
|
matrix:
|
|
@@ -149,7 +148,7 @@ jobs:
|
|
|
149
148
|
tags: '${{ steps.meta.outputs.tags }}'
|
|
150
149
|
|
|
151
150
|
publish_pypi:
|
|
152
|
-
needs: [
|
|
151
|
+
needs: [publish_docker]
|
|
153
152
|
runs-on: ubuntu-latest
|
|
154
153
|
name: 'Publish / PyPI'
|
|
155
154
|
steps:
|
cgitize-7.0.0/.pylintrc
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[MAIN]
|
|
2
|
+
# Enable Pylint to be run in the venv:
|
|
3
|
+
init-hook=
|
|
4
|
+
try: import pylint_venv
|
|
5
|
+
except ImportError: pass
|
|
6
|
+
else: pylint_venv.inithook()
|
|
7
|
+
|
|
8
|
+
[MESSAGES CONTROL]
|
|
9
|
+
|
|
10
|
+
disable=
|
|
11
|
+
invalid-name,
|
|
12
|
+
missing-docstring,
|
|
13
|
+
too-few-public-methods,
|
|
14
|
+
too-many-arguments,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13.13
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cgitize
|
|
3
|
-
Version:
|
|
3
|
+
Version: 7.0.0
|
|
4
4
|
Summary: Self-host your repositories using cgit
|
|
5
5
|
Author-email: Egor Tensin <egor@tensin.name>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/egor-tensin/cgitize
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/egor-tensin/cgitize/issues
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
11
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
13
12
|
Requires-Python: >=3.9
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
from atlassian.bitbucket.cloud import Cloud
|
|
9
9
|
from requests.exceptions import HTTPError
|
|
10
10
|
|
|
11
|
-
from cgitize.repo import Repo
|
|
11
|
+
from cgitize.repo import Repo, Visibility
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Bitbucket:
|
|
@@ -28,10 +28,10 @@ class Bitbucket:
|
|
|
28
28
|
logging.error("Couldn't fetch repository: %s", repo.id)
|
|
29
29
|
raise
|
|
30
30
|
|
|
31
|
-
def get_user_repos(self, user):
|
|
31
|
+
def get_user_repos(self, user, visibility=Visibility.ALL):
|
|
32
32
|
try:
|
|
33
33
|
workspace = self._impl.workspaces.get(user.name)
|
|
34
|
-
yield from workspace.repositories.each()
|
|
34
|
+
yield from workspace.repositories.each(q=visibility.to_bitbucket_arg())
|
|
35
35
|
except HTTPError:
|
|
36
36
|
logging.error("Couldn't fetch user repositories: %s", user.name)
|
|
37
37
|
raise
|
|
@@ -11,7 +11,7 @@ import tomli
|
|
|
11
11
|
from cgitize.bitbucket import Bitbucket
|
|
12
12
|
from cgitize.github import GitHub
|
|
13
13
|
from cgitize.gitlab import GitLab
|
|
14
|
-
from cgitize.repo import Repo
|
|
14
|
+
from cgitize.repo import Repo, Visibility
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class Section:
|
|
@@ -74,7 +74,8 @@ class ServiceSection(Section, ABC):
|
|
|
74
74
|
yield api.convert_repo(api.get_repo(r), cfg, r.dir)
|
|
75
75
|
|
|
76
76
|
def _enum_user_repositories(self, cfg, api, user):
|
|
77
|
-
|
|
77
|
+
visibility = Visibility.from_config(user.public_repos, user.private_repos)
|
|
78
|
+
for r in api.get_user_repos(user, visibility=visibility):
|
|
78
79
|
r = api.convert_repo(r, cfg, user.dir)
|
|
79
80
|
if r.name in user.skip:
|
|
80
81
|
continue
|
|
@@ -201,12 +202,7 @@ class RepositoriesSection(Section):
|
|
|
201
202
|
return self.impl.values()
|
|
202
203
|
|
|
203
204
|
|
|
204
|
-
class
|
|
205
|
-
def __init__(self, impl):
|
|
206
|
-
if 'name' not in impl:
|
|
207
|
-
raise ValueError("every user must have a 'name'")
|
|
208
|
-
self._impl = impl
|
|
209
|
-
|
|
205
|
+
class Entity(ABC):
|
|
210
206
|
@property
|
|
211
207
|
def name(self):
|
|
212
208
|
return self._impl['name']
|
|
@@ -220,7 +216,22 @@ class User:
|
|
|
220
216
|
return self._impl.get('skip', [])
|
|
221
217
|
|
|
222
218
|
|
|
223
|
-
class
|
|
219
|
+
class User(Entity):
|
|
220
|
+
def __init__(self, impl):
|
|
221
|
+
if 'name' not in impl:
|
|
222
|
+
raise ValueError("every user must have a 'name'")
|
|
223
|
+
self._impl = impl
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def public_repos(self):
|
|
227
|
+
return self._impl.get('public', True)
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def private_repos(self):
|
|
231
|
+
return self._impl.get('private', False)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class Org(Entity):
|
|
224
235
|
def __init__(self, impl):
|
|
225
236
|
if 'name' not in impl:
|
|
226
237
|
raise ValueError("every organization must have a 'name'")
|
|
@@ -7,7 +7,7 @@ import logging
|
|
|
7
7
|
|
|
8
8
|
from github import Auth, Github, GithubException
|
|
9
9
|
|
|
10
|
-
from cgitize.repo import Repo
|
|
10
|
+
from cgitize.repo import Repo, Visibility
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class GitHub:
|
|
@@ -25,14 +25,24 @@ class GitHub:
|
|
|
25
25
|
logging.error("Couldn't fetch repository: %s", repo.id)
|
|
26
26
|
raise
|
|
27
27
|
|
|
28
|
-
def get_user_repos(self, user):
|
|
28
|
+
def get_user_repos(self, user, visibility=Visibility.ALL):
|
|
29
|
+
visibility = visibility.to_github_arg()
|
|
30
|
+
|
|
31
|
+
# Not actually certain how it works, but just passing None as the
|
|
32
|
+
# named visibility parameter fails with an internal assert error. I
|
|
33
|
+
# honestly thought that that passing parameters like that and as a
|
|
34
|
+
# None makes no difference.
|
|
35
|
+
kwargs = {}
|
|
36
|
+
if visibility is not None:
|
|
37
|
+
kwargs['visibility'] = visibility
|
|
38
|
+
|
|
29
39
|
try:
|
|
30
40
|
if user.name == self._username:
|
|
31
41
|
# To get private repositories, get_user() must be called
|
|
32
42
|
# without arguments:
|
|
33
|
-
return self._impl.get_user().get_repos(affiliation='owner')
|
|
43
|
+
return self._impl.get_user().get_repos(affiliation='owner', **kwargs)
|
|
34
44
|
else:
|
|
35
|
-
return self._impl.get_user(user.name).get_repos()
|
|
45
|
+
return self._impl.get_user(user.name).get_repos(**kwargs)
|
|
36
46
|
except GithubException:
|
|
37
47
|
logging.error("Couldn't fetch user repositories: %s", user.name)
|
|
38
48
|
raise
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
from gitlab import Gitlab
|
|
9
9
|
from gitlab.exceptions import GitlabGetError
|
|
10
10
|
|
|
11
|
-
from cgitize.repo import Repo
|
|
11
|
+
from cgitize.repo import Repo, Visibility
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class GitLab:
|
|
@@ -22,7 +22,8 @@ class GitLab:
|
|
|
22
22
|
logging.error("Couldn't fetch repository: %s", repo.id)
|
|
23
23
|
raise
|
|
24
24
|
|
|
25
|
-
def get_user_repos(self, user):
|
|
25
|
+
def get_user_repos(self, user, visibility=Visibility.ALL):
|
|
26
|
+
visibility = visibility.to_gitlab_arg()
|
|
26
27
|
try:
|
|
27
28
|
# Strictly speaking, GitLab supports the /users/:username/projects
|
|
28
29
|
# endpoint, which means you shouldn't need to fetch the user first,
|
|
@@ -32,7 +33,7 @@ class GitLab:
|
|
|
32
33
|
raise RuntimeError(f"Couldn't find GitLab user: {user.name}")
|
|
33
34
|
assert len(users) == 1
|
|
34
35
|
user = users[0]
|
|
35
|
-
return user.projects.list()
|
|
36
|
+
return user.projects.list(visibility=visibility)
|
|
36
37
|
except GitlabGetError:
|
|
37
38
|
logging.error("Couldn't fetch user repositories: %s", user.name)
|
|
38
39
|
raise
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright (c) 2026 Egor Tensin <egor@tensin.name>
|
|
2
|
+
# This file is part of the "cgitize" project.
|
|
3
|
+
# For details, see https://github.com/egor-tensin/cgitize.
|
|
4
|
+
# Distributed under the MIT License.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def update(path, success, error=None):
|
|
8
|
+
with open(path, 'w') as file:
|
|
9
|
+
contents = ''
|
|
10
|
+
if not success:
|
|
11
|
+
contents = (
|
|
12
|
+
'''<p style="text-align: center; color: red; font-weight: bold;">'''
|
|
13
|
+
)
|
|
14
|
+
contents += '''Some repositories couldn't be updated, please check application logs for details.'''
|
|
15
|
+
if error is not None:
|
|
16
|
+
contents += f'''<br>{type(error).__name__}: {error}'''
|
|
17
|
+
contents += '''</p>\n'''
|
|
18
|
+
file.write(contents)
|
|
@@ -9,6 +9,7 @@ import sys
|
|
|
9
9
|
|
|
10
10
|
from cgitize.cgit import CGitRepositories, CGitServer
|
|
11
11
|
from cgitize.config import Config
|
|
12
|
+
from cgitize.header import update as update_header
|
|
12
13
|
from cgitize.utils import setup_logging
|
|
13
14
|
from cgitize.version import __version__
|
|
14
15
|
|
|
@@ -39,20 +40,6 @@ def parse_args(argv=None):
|
|
|
39
40
|
return parser.parse_args(argv)
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
def setup_error_header_file(error_header_path, success, error=None):
|
|
43
|
-
with open(error_header_path, 'w') as file:
|
|
44
|
-
contents = ''
|
|
45
|
-
if not success:
|
|
46
|
-
contents = (
|
|
47
|
-
'''<p style="text-align: center; color: red; font-weight: bold;">'''
|
|
48
|
-
)
|
|
49
|
-
contents += '''Some repositories couldn't be updated, please check application logs for details.'''
|
|
50
|
-
if error is not None:
|
|
51
|
-
contents += f'''<br>{type(error).__name__}: {error}'''
|
|
52
|
-
contents += '''</p>\n'''
|
|
53
|
-
file.write(contents)
|
|
54
|
-
|
|
55
|
-
|
|
56
43
|
def main(argv=None):
|
|
57
44
|
args = parse_args(argv)
|
|
58
45
|
with setup_logging(args.verbose):
|
|
@@ -79,7 +66,7 @@ def main(argv=None):
|
|
|
79
66
|
if error is not None:
|
|
80
67
|
logging.warning('Error: %s', error)
|
|
81
68
|
|
|
82
|
-
|
|
69
|
+
update_header(config.main.error_header_path, success, error)
|
|
83
70
|
return int(not success)
|
|
84
71
|
|
|
85
72
|
|
|
@@ -3,11 +3,64 @@
|
|
|
3
3
|
# For details, see https://github.com/egor-tensin/cgitize.
|
|
4
4
|
# Distributed under the MIT License.
|
|
5
5
|
|
|
6
|
+
from enum import Enum
|
|
6
7
|
import os.path
|
|
7
8
|
|
|
8
9
|
from cgitize.utils import url_remove_auth, url_replace_auth
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
class Visibility(Enum):
|
|
13
|
+
ALL = 'all'
|
|
14
|
+
PUBLIC = 'public'
|
|
15
|
+
PRIVATE = 'private'
|
|
16
|
+
|
|
17
|
+
def __str__(self):
|
|
18
|
+
return self.name
|
|
19
|
+
|
|
20
|
+
@staticmethod
|
|
21
|
+
def from_config(public, private):
|
|
22
|
+
if public and private:
|
|
23
|
+
return Visibility.ALL
|
|
24
|
+
if not public and not private:
|
|
25
|
+
raise RuntimeError(
|
|
26
|
+
'you need to fetch either public or private repos, or both'
|
|
27
|
+
)
|
|
28
|
+
if public:
|
|
29
|
+
return Visibility.PUBLIC
|
|
30
|
+
return Visibility.PRIVATE
|
|
31
|
+
|
|
32
|
+
def to_bitbucket_arg(self):
|
|
33
|
+
# https://developer.atlassian.com/cloud/bitbucket/rest/intro/#filtering
|
|
34
|
+
# https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-group-repositories
|
|
35
|
+
if self is Visibility.ALL:
|
|
36
|
+
return None
|
|
37
|
+
if self is Visibility.PUBLIC:
|
|
38
|
+
return 'is_private=False'
|
|
39
|
+
if self is Visibility.PRIVATE:
|
|
40
|
+
return 'is_private=True'
|
|
41
|
+
raise NotImplementedError(f'not implemented visibility level: {self}')
|
|
42
|
+
|
|
43
|
+
def to_github_arg(self):
|
|
44
|
+
# https://docs.github.com/en/rest/repos/repos?apiVersion=2026-03-10#list-repositories-for-the-authenticated-user
|
|
45
|
+
if self is Visibility.ALL:
|
|
46
|
+
return None
|
|
47
|
+
if self is Visibility.PUBLIC:
|
|
48
|
+
return 'public'
|
|
49
|
+
if self is Visibility.PRIVATE:
|
|
50
|
+
return 'private'
|
|
51
|
+
raise NotImplementedError(f'not implemented visibility level: {self}')
|
|
52
|
+
|
|
53
|
+
def to_gitlab_arg(self):
|
|
54
|
+
# https://python-gitlab.readthedocs.io/en/stable/gl_objects/projects.html#projects
|
|
55
|
+
if self is Visibility.ALL:
|
|
56
|
+
return None
|
|
57
|
+
if self is Visibility.PUBLIC:
|
|
58
|
+
return 'public'
|
|
59
|
+
if self is Visibility.PRIVATE:
|
|
60
|
+
return 'private'
|
|
61
|
+
raise NotImplementedError(f'not implemented visibility level: {self}')
|
|
62
|
+
|
|
63
|
+
|
|
11
64
|
class Repo:
|
|
12
65
|
@staticmethod
|
|
13
66
|
def from_config(src, config):
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cgitize
|
|
3
|
-
Version:
|
|
3
|
+
Version: 7.0.0
|
|
4
4
|
Summary: Self-host your repositories using cgit
|
|
5
5
|
Author-email: Egor Tensin <egor@tensin.name>
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/egor-tensin/cgitize
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/egor-tensin/cgitize/issues
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
11
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
13
12
|
Requires-Python: >=3.9
|
|
@@ -37,7 +37,7 @@ ENV PYTHONPATH="/deps:/usr/src"
|
|
|
37
37
|
|
|
38
38
|
ARG ssh_sock_dir=/
|
|
39
39
|
ARG ssh_sock_path="$ssh_sock_dir/ssh-agent.sock"
|
|
40
|
-
ENV SSH_AUTH_SOCK
|
|
40
|
+
ENV SSH_AUTH_SOCK="$ssh_sock_path"
|
|
41
41
|
|
|
42
42
|
COPY ["docker/cgitize.sh", "/"]
|
|
43
43
|
COPY ["docker/get_output_dir.py", "/"]
|
|
@@ -34,6 +34,10 @@ dir = "github-dir"
|
|
|
34
34
|
# Repositories to skip:
|
|
35
35
|
skip = ["repo1", "repo2"]
|
|
36
36
|
|
|
37
|
+
# The defaults.
|
|
38
|
+
public = true
|
|
39
|
+
private = false
|
|
40
|
+
|
|
37
41
|
[github.organizations.goauthentik]
|
|
38
42
|
# For GitHub, you can also specify organizations. The settings are similar to
|
|
39
43
|
# those for users. "goauthentik" is a random organization.
|
|
@@ -66,6 +70,10 @@ name = "cgitize-test-workspace"
|
|
|
66
70
|
dir = "bitbucket-dir"
|
|
67
71
|
#skip = ["repo1", "repo2"]
|
|
68
72
|
|
|
73
|
+
# The defaults.
|
|
74
|
+
public = true
|
|
75
|
+
private = false
|
|
76
|
+
|
|
69
77
|
# Some random repositories hosted on Bitbucket:
|
|
70
78
|
[bitbucket.repositories.cef]
|
|
71
79
|
id = "chromiumembedded/cef"
|
|
@@ -89,6 +97,10 @@ name = "cgitize-test"
|
|
|
89
97
|
dir = "gitlab-dir"
|
|
90
98
|
#skip = ["repo1", "repo2"]
|
|
91
99
|
|
|
100
|
+
# The defaults.
|
|
101
|
+
public = true
|
|
102
|
+
private = false
|
|
103
|
+
|
|
92
104
|
# Some random repositories hosted on Gitlab:
|
|
93
105
|
[gitlab.repositories.gitter]
|
|
94
106
|
id = "gitterHQ/webapp"
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
|
|
2
|
+
# The SPDX license identifiers are available from 77.0.3:
|
|
3
|
+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license-and-license-files
|
|
4
|
+
requires = ["setuptools >= 77.0.3", "setuptools-scm"]
|
|
3
5
|
build-backend = "setuptools.build_meta"
|
|
4
6
|
|
|
5
7
|
[project]
|
|
6
8
|
name = "cgitize"
|
|
7
9
|
description = "Self-host your repositories using cgit"
|
|
8
|
-
license =
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE.txt"]
|
|
9
12
|
dynamic = ["version"]
|
|
10
13
|
authors = [{name = "Egor Tensin", email = "egor@tensin.name"}]
|
|
11
14
|
readme = "README.md"
|
|
@@ -21,7 +24,6 @@ dependencies = [
|
|
|
21
24
|
|
|
22
25
|
classifiers = [
|
|
23
26
|
"Development Status :: 5 - Production/Stable",
|
|
24
|
-
"License :: OSI Approved :: MIT License",
|
|
25
27
|
"Programming Language :: Python :: 3",
|
|
26
28
|
"Topic :: Software Development :: Version Control :: Git",
|
|
27
29
|
]
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
atlassian-python-api==4.0.7
|
|
2
2
|
beautifulsoup4==4.14.3
|
|
3
|
-
certifi==2026.
|
|
3
|
+
certifi==2026.5.20
|
|
4
4
|
cffi==2.0.0
|
|
5
5
|
charset-normalizer==3.4.7
|
|
6
6
|
cryptography==48.0.0
|
|
7
7
|
Deprecated==1.3.1
|
|
8
|
-
idna==3.
|
|
8
|
+
idna==3.16
|
|
9
9
|
jmespath==1.1.0
|
|
10
10
|
oauthlib==3.3.1
|
|
11
11
|
pycparser==3.0
|
|
12
12
|
PyGithub==2.9.1
|
|
13
|
-
PyJWT==2.
|
|
13
|
+
PyJWT==2.13.0
|
|
14
14
|
PyNaCl==1.6.2
|
|
15
15
|
python-gitlab==6.5.0
|
|
16
16
|
requests==2.34.2
|
|
@@ -20,4 +20,4 @@ soupsieve==2.8.3
|
|
|
20
20
|
tomli==2.4.1
|
|
21
21
|
typing_extensions==4.15.0
|
|
22
22
|
urllib3==2.7.0
|
|
23
|
-
wrapt==2.
|
|
23
|
+
wrapt==2.2.0
|
|
@@ -25,6 +25,14 @@ clone_via_ssh_false() {
|
|
|
25
25
|
sed -i -E -e 's/^clone_via_ssh = (true|false)$/clone_via_ssh = false/' -- "$cgitize_toml_path"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
private_repos_true() {
|
|
29
|
+
sed -i -E -e 's/^private = (true|false)$/private = true/' -- "$cgitize_toml_path"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private_repos_false() {
|
|
33
|
+
sed -i -E -e 's/^private = (true|false)$/private = false/' -- "$cgitize_toml_path"
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
cleanup() {
|
|
29
37
|
echo
|
|
30
38
|
echo ----------------------------------------------------------------------
|
|
@@ -35,6 +43,8 @@ cleanup() {
|
|
|
35
43
|
rm -rf -- "$output_dir"
|
|
36
44
|
echo "Reverting clone_via_ssh settings: $cgitize_toml_path"
|
|
37
45
|
clone_via_ssh_false
|
|
46
|
+
echo "Reverting repository visibility settings: $cgitize_toml_path"
|
|
47
|
+
private_repos_false
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
cgitize() {
|
|
@@ -54,6 +64,10 @@ setup_https() {
|
|
|
54
64
|
clone_via_ssh_false
|
|
55
65
|
}
|
|
56
66
|
|
|
67
|
+
setup_private_repos() {
|
|
68
|
+
private_repos_true
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
verify_origin() {
|
|
58
72
|
if [ "$#" -ne 2 ]; then
|
|
59
73
|
echo "usage: ${FUNCNAME[0]} REPO URL" >&2
|
|
@@ -136,11 +150,8 @@ test_ssh() {
|
|
|
136
150
|
wireguard/wintun \
|
|
137
151
|
goauthentik-dir/authentik \
|
|
138
152
|
github-dir/public \
|
|
139
|
-
github-dir/private \
|
|
140
153
|
bitbucket-dir/public \
|
|
141
|
-
bitbucket-dir/private \
|
|
142
154
|
gitlab-dir/public \
|
|
143
|
-
gitlab-dir/private
|
|
144
155
|
|
|
145
156
|
verify_origin lens 'git@github.com:ekmett/lens.git'
|
|
146
157
|
verify_origin chromiumembedded/cef 'git@bitbucket.org:chromiumembedded/cef.git'
|
|
@@ -148,11 +159,8 @@ test_ssh() {
|
|
|
148
159
|
verify_origin goauthentik-dir/authentik 'git@github.com:goauthentik/authentik.git'
|
|
149
160
|
|
|
150
161
|
verify_origin github-dir/public 'git@github.com:cgitize-test/public.git'
|
|
151
|
-
verify_origin github-dir/private 'git@github.com:cgitize-test/private.git'
|
|
152
162
|
verify_origin bitbucket-dir/public 'git@bitbucket.org:cgitize-test-workspace/public.git'
|
|
153
|
-
verify_origin bitbucket-dir/private 'git@bitbucket.org:cgitize-test-workspace/private.git'
|
|
154
163
|
verify_origin gitlab-dir/public 'git@gitlab.com:cgitize-test/public.git'
|
|
155
|
-
verify_origin gitlab-dir/private 'git@gitlab.com:cgitize-test/private.git'
|
|
156
164
|
|
|
157
165
|
cleanup
|
|
158
166
|
success
|
|
@@ -167,6 +175,44 @@ test_https() {
|
|
|
167
175
|
setup_https
|
|
168
176
|
cgitize
|
|
169
177
|
|
|
178
|
+
verify_repos \
|
|
179
|
+
lens \
|
|
180
|
+
chromiumembedded/cef \
|
|
181
|
+
graphviz \
|
|
182
|
+
wireguard/wintun \
|
|
183
|
+
goauthentik-dir/authentik \
|
|
184
|
+
github-dir/public \
|
|
185
|
+
bitbucket-dir/public \
|
|
186
|
+
gitlab-dir/public
|
|
187
|
+
|
|
188
|
+
verify_no_repos \
|
|
189
|
+
github-dir/private \
|
|
190
|
+
bitbucket-dir/private \
|
|
191
|
+
gitlab-dir/private
|
|
192
|
+
|
|
193
|
+
verify_origin lens 'https://github.com/ekmett/lens.git'
|
|
194
|
+
verify_origin chromiumembedded/cef 'https://bitbucket.org/chromiumembedded/cef.git'
|
|
195
|
+
verify_origin graphviz 'https://gitlab.com/graphviz/graphviz.git'
|
|
196
|
+
verify_origin goauthentik-dir/authentik 'https://github.com/goauthentik/authentik.git'
|
|
197
|
+
|
|
198
|
+
verify_origin github-dir/public 'https://github.com/cgitize-test/public.git'
|
|
199
|
+
verify_origin bitbucket-dir/public 'https://bitbucket.org/cgitize-test-workspace/public.git'
|
|
200
|
+
verify_origin gitlab-dir/public 'https://gitlab.com/cgitize-test/public.git'
|
|
201
|
+
|
|
202
|
+
cleanup
|
|
203
|
+
success
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
test_https_private() {
|
|
207
|
+
echo
|
|
208
|
+
echo ======================================================================
|
|
209
|
+
echo "${FUNCNAME[0]}"
|
|
210
|
+
echo ======================================================================
|
|
211
|
+
|
|
212
|
+
setup_https
|
|
213
|
+
setup_private_repos
|
|
214
|
+
cgitize
|
|
215
|
+
|
|
170
216
|
verify_repos \
|
|
171
217
|
lens \
|
|
172
218
|
chromiumembedded/cef \
|
|
@@ -214,6 +260,7 @@ main() {
|
|
|
214
260
|
trap cleanup EXIT
|
|
215
261
|
test_ssh
|
|
216
262
|
test_https
|
|
263
|
+
test_https_private
|
|
217
264
|
test_one_repo
|
|
218
265
|
}
|
|
219
266
|
|
|
@@ -30,6 +30,8 @@ class BitbucketTests(unittest.TestCase):
|
|
|
30
30
|
self.assertEqual(r.data['workspace']['name'], 'Test cgitize workspace')
|
|
31
31
|
self.assertEqual(r.data['workspace']['slug'], 'cgitize-test-workspace')
|
|
32
32
|
|
|
33
|
+
self.assertFalse(r.data['is_private'])
|
|
34
|
+
|
|
33
35
|
self.assertEqual(
|
|
34
36
|
r.get_link('html'), 'https://bitbucket.org/cgitize-test-workspace/public'
|
|
35
37
|
)
|
|
@@ -57,6 +59,8 @@ class BitbucketTests(unittest.TestCase):
|
|
|
57
59
|
self.assertEqual(r.data['workspace']['name'], 'Test cgitize workspace')
|
|
58
60
|
self.assertEqual(r.data['workspace']['slug'], 'cgitize-test-workspace')
|
|
59
61
|
|
|
62
|
+
self.assertTrue(r.data['is_private'])
|
|
63
|
+
|
|
60
64
|
self.assertEqual(
|
|
61
65
|
r.get_link('html'), 'https://bitbucket.org/cgitize-test-workspace/private'
|
|
62
66
|
)
|
|
@@ -23,6 +23,7 @@ class GitHubTests(unittest.TestCase):
|
|
|
23
23
|
self.assertEqual(r.description, 'Public test cgitize repository')
|
|
24
24
|
self.assertEqual(r.owner.name, 'Test cgitize user')
|
|
25
25
|
self.assertEqual(r.owner.login, 'cgitize-test')
|
|
26
|
+
self.assertEqual(r.visibility, 'public')
|
|
26
27
|
self.assertEqual(r.html_url, 'https://github.com/cgitize-test/public')
|
|
27
28
|
self.assertEqual(r.clone_url, 'https://github.com/cgitize-test/public.git')
|
|
28
29
|
self.assertEqual(r.ssh_url, 'git@github.com:cgitize-test/public.git')
|
|
@@ -33,6 +34,7 @@ class GitHubTests(unittest.TestCase):
|
|
|
33
34
|
self.assertEqual(r.description, 'Private test cgitize repository')
|
|
34
35
|
self.assertEqual(r.owner.name, 'Test cgitize user')
|
|
35
36
|
self.assertEqual(r.owner.login, 'cgitize-test')
|
|
37
|
+
self.assertEqual(r.visibility, 'private')
|
|
36
38
|
self.assertEqual(r.html_url, 'https://github.com/cgitize-test/private')
|
|
37
39
|
self.assertEqual(r.clone_url, 'https://github.com/cgitize-test/private.git')
|
|
38
40
|
self.assertEqual(r.ssh_url, 'git@github.com:cgitize-test/private.git')
|
|
@@ -26,6 +26,7 @@ class GitLabTests(unittest.TestCase):
|
|
|
26
26
|
self.assertEqual(r.description, 'Public test cgitize repository')
|
|
27
27
|
self.assertEqual(r.namespace['name'], 'Test cgitize user')
|
|
28
28
|
self.assertEqual(r.namespace['path'], 'cgitize-test')
|
|
29
|
+
self.assertEqual(r.visibility, 'public')
|
|
29
30
|
self.assertEqual(r.web_url, 'https://gitlab.com/cgitize-test/public')
|
|
30
31
|
self.assertEqual(
|
|
31
32
|
r.http_url_to_repo, 'https://gitlab.com/cgitize-test/public.git'
|
|
@@ -38,6 +39,7 @@ class GitLabTests(unittest.TestCase):
|
|
|
38
39
|
self.assertEqual(r.description, 'Private test cgitize repository')
|
|
39
40
|
self.assertEqual(r.namespace['name'], 'Test cgitize user')
|
|
40
41
|
self.assertEqual(r.namespace['path'], 'cgitize-test')
|
|
42
|
+
self.assertEqual(r.visibility, 'private')
|
|
41
43
|
self.assertEqual(r.web_url, 'https://gitlab.com/cgitize-test/private')
|
|
42
44
|
self.assertEqual(
|
|
43
45
|
r.http_url_to_repo, 'https://gitlab.com/cgitize-test/private.git'
|
cgitize-6.0.4/.pylintrc
DELETED
cgitize-6.0.4/.python-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.10.10
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/usr/lib/cgit/filters/html-converters/.gitattributes
RENAMED
|
File without changes
|
{cgitize-6.0.4 → cgitize-7.0.0}/docker/frontend/usr/lib/cgit/filters/html-converters/md2html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|