Read about our upcoming Code of Conduct on this issue

Commit 7ecb143d authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Packaging: imported fetch-watch-tags as a module

The given paths will now be interpreted from the current
working directory, as this is more natural for a console script,
that typically is installed in some `bin` directory (by default
on the conversion system, it will be `~/.local/bin`. Services and
timers can still use absolute paths.

This change brings in the dependency to `requests`, or, rather, makes
it explicit.

Also, Python console scripts take care of returning with code 0
if the callable returns nothing (actually, `None`).

Complements: `sys.exit(None)` gives return code 1 in interactive
sessions and code 0 if non-interactive.
parent bee38da7b9b3
fetch-watch-tags.py
\ No newline at end of file
#!/bin/sh
echo "This script has been replaced by a setuptools console script. "
echo "Please run ~/.local/bin/fetch-watch-tags instead. "
echo "If not installed, run 'make help'"
......@@ -42,6 +42,7 @@
parser.add_argument("--heptapod-repo", default='heptapod-rails')
parser.add_argument("--gitlab-repo", default='gitlab-ce')
parser.add_argument("--branch-prefix")
parser.add_argument("--min-gitlab-version", default=(13, 9))
cl_args = parser.parse_args()
......
#!/usr/bin/env python3
# Copyright 2020-2021 Georges Racinet <georges.racinet@octobus.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#
# SPDX-License-Identifier: GPL-2.0-or-later
import argparse
import os
import re
import requests
......@@ -2,9 +7,8 @@
import argparse
import os
import re
import requests
import sys
from subprocess import Popen, PIPE
# Regular expression for a new version tag on the remote.
......@@ -23,8 +27,10 @@
[upstream-conversion](https://foss.heptapod.net/heptapod/upstream-conversion)
project used for the conversion.
(if a script is not found, add `$HOME/.local/bin` to $PATH)
- [ ] Main repository:
```
cd gitlab-ce
../fetch-stable-branches.sh
......@@ -26,10 +32,10 @@
- [ ] Main repository:
```
cd gitlab-ce
../fetch-stable-branches.sh
cd ..
./convert-pull-local --branch-prefix {git_branch}
cd
convert-pull-local --branch-prefix {git_branch}
cd heptapod-rails
hg push -fB {git_branch} [URL]
../convert-git-tags-push
......@@ -40,10 +46,10 @@
```
cd omnibus-gitlab
../fetch-stable-branches.sh
cd ..
./convert-pull-local --gitlab-repo omnibus-gitlab \
--heptapod-repo omnibus-heptapod \
--branch-prefix {git_branch}
cd
convert-pull-local --gitlab-repo omnibus-gitlab \
--heptapod-repo omnibus-heptapod \
--branch-prefix {git_branch}
cd omnibus-heptapod
hg push -fB {git_branch} [URL]
../convert-git-tags-push
......@@ -136,8 +142,9 @@
parser.add_argument("-s", "--simulate", action='store_true')
parser.add_argument("--gitlab-repo", default='gitlab-ce',
help="Path to GitLab CE Git repo, relative "
"to this script location")
parser.add_argument("--create-issue", "--create-issues",
"to the parent direcoty of the "
"`heptapod_git_conversion` package")
parser.add_argument("--create-issues", "--create-issue",
action='store_true')
parser.add_argument("--heptapod-token",
default='~/.gitlab-release-watcher.token')
......@@ -154,8 +161,6 @@
cl_args = parser.parse_args()
simulate = cl_args.simulate
parent_dir = os.path.dirname(__file__)
os.chdir(parent_dir)
os.chdir(cl_args.gitlab_repo)
cmd = ['git', 'fetch', '--tags']
......@@ -202,8 +207,3 @@
token=cl_args.heptapod_token,
project=cl_args.heptapod_project,
simulate=simulate)
if __name__ == '__main__':
res = main()
sys.exit(0 if res is None else res)
......@@ -4,5 +4,6 @@
scripts = { # name to (module in main package, function)
'convert-pull-local': ('convert', 'main'),
'fetch-watch-tags': ('fetch_watch_tags', 'main'),
}
......@@ -7,5 +8,10 @@
}
with open('install-requirements.txt', 'r') as install_reqf:
install_req = [req.strip() for req in install_reqf]
setup(
name='heptapod_upstream_conversion',
version='0.1.0dev0',
......@@ -27,5 +33,5 @@
pkg=MAIN_PACKAGE, name=name, mod=mod, fun=fun)
for name, (mod, fun) in scripts.items()],
),
install_requires=()
install_requires=install_req
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment