Esempio n. 1
0
def extract_tarball(tarball):
    utils.notice(f"Extracting {tarball} . . .")
    with tarfile.open(tarball) as tar:
        try:
            tar.extractall()
        except:
            utils.error(f"Failed to extract {tarball}!")
 def run(self):
     # print(f"开启线程{self.name}")
     threadLock.acquire()
     print("正在加载语音")
     notice('1')
     print("语音加载完成")
     threadLock.release()
Esempio n. 3
0
def download_asset_by_name(asset_name, writedir):
    try:
        url = [x for x in assets
               if x.name == asset_name][0].browser_download_url
    except:
        utils.error(
            f"Cannot find {asset_name} in the GitHub release with tag {release.tag_name}"
        )

    with utils.working_directory(writedir):
        utils.notice(f"Downloading {url} to {writedir} . . .")
        utils.download_with_sha256(url, asset_name)
Esempio n. 4
0
# As in make_archives.py, the version of the gap release is taken from the
# Makefile variable GAP_BUILD_VERSION.

# If we do import * from utils, then initialize_github can't overwrite the
# global GITHUB_INSTANCE and CURRENT_REPO variables.
import utils
import github
import os

# Identify GAP release version
try:
    GAPVERSION = utils.get_makefile_var("GAP_BUILD_VERSION")
except:
    utils.error("Could not get GAP version")

utils.notice(f"Detected GAP version {GAPVERSION}")

utils.initialize_github()

# Error if this release has been already created on GitHub
if utils.check_whether_github_release_exists("v"+GAPVERSION):
    utils.error(f"Release v{GAPVERSION} already exists!")

# Create release
CURRENT_BRANCH = utils.get_makefile_var("PKG_BRANCH")
RELEASE_NOTE = f"For an overview of changes in GAP {GAPVERSION} see the " \
    + "[CHANGES.md](https://github.com/gap-system/gap/blob/master/CHANGES.md) file."
utils.notice(f"Creating release v{GAPVERSION}")
RELEASE = utils.CURRENT_REPO.create_git_release("v"+GAPVERSION, "v"+GAPVERSION,
                                                RELEASE_NOTE,
                                                target_commitish=CURRENT_BRANCH,
Esempio n. 5
0
        f"Repository {utils.CURRENT_REPO_NAME} has no tag '{TAG_NAME}'")

# make sure that TAG_NAME
# - exists
# - is an annotated tag
# - points to current HEAD
utils.check_git_tag_for_release(TAG_NAME)

# Error if this release has been already created on GitHub
if any(r.tag_name == TAG_NAME for r in utils.CURRENT_REPO.get_releases()):
    utils.error(f"Github release with tag '{TAG_NAME}' already exists!")

# Create release
RELEASE_NOTE = f"For an overview of changes in GAP {TAG_NAME[1:]} see the " \
    + f"[CHANGES.md](https://github.com/gap-system/gap/blob/{TAG_NAME}/CHANGES.md) file."
utils.notice(f"Creating release {TAG_NAME}")
RELEASE = utils.CURRENT_REPO.create_git_release(TAG_NAME,
                                                TAG_NAME,
                                                RELEASE_NOTE,
                                                prerelease=True)

with utils.working_directory(PATH_TO_RELEASE):
    manifest_filename = "MANIFEST"
    with open(manifest_filename, 'r') as manifest_file:
        manifest = manifest_file.read().splitlines()

    utils.notice(f"Contents of {manifest_filename}:")
    for filename in manifest:
        print(filename)

    # Now check that TAG_NAME and the created archives belong together
Esempio n. 6
0
        action_user=author.key,
        action='hanasy_notice',
        app_name='hanasee',
        settings='favoriteHanaseeNews',
        hanasy=hanasy.key,
        author=author.key,
        visible=True,
        message=message,
        url=url).send(['APP','MAIL'])

      result['code'] = 200
      result['message'] = 'OK'
      result['Hanasee'] = hanasy.to_obj()
      return self.createRes(200, result)
    elif action in ['addcomment', 'delcomment']:
      notice = utils.notice('ssulit')

      if action == 'addcomment':
        message = self.arguments.get(
          'message',
          u'%s 님이 당신의 하나시에 댓글을 달았습니다' % (getattr(user, 'nickname') if user else u'익명'))
        url = self.arguments.get('url', '/hanasee/%s/%s' % (author.key.id(), hanasy.key.id()))

        if self.get_user() and author.key.id() != self.get_user().get('uid'):
          Messages(user=author.key,
            action_user=ndb.Key(Users, self.get_user().get('uid')) if self.get_user() else {},
            action='hanasy_addcomment',
            settings='comment',
            app_name='hanasee',
            hanasy=hanasy.key,
            author=author.key,
Esempio n. 7
0
            assets_unix.append(asset)

# Release date
if args.use_github_date:
    release_date = release.published_at  # datetime object

# Version
gap_version = release.tag_name[1:]
gap_version_major, gap_version_minor = gap_version.split(".")[1:]

if not args.branch == None:
    branch = args.branch
else:
    branch = "gap-" + gap_version

notice("Using GAP release: " + gap_version)
notice("Using temporary directory: " + tmpdir)

################################################################################
# Download and extract the release asset named "gap-4.X.Y.tar.gz"
tarball = "gap-" + gap_version + ".tar.gz"
tarball_url = [x for x in assets_unix if x.name == tarball]
try:
    tarball_url = tarball_url[0].browser_download_url
except:
    error("cannot find " + tarball + " in release at tag " + release.tag_name)

gaproot = tmpdir + "gap-" + gap_version + "/"
pkg_dir = gaproot + "pkg/"
gap_exe = gaproot + "bin/gap.sh"
Esempio n. 8
0
# This function deals with package-infos.json.gz and help-links.json.gz.
# The function downloads the release asset called <asset_name> to the tmpdir.
# The asset is assumed to be gzipped. It is extracted to the filepath <dest>.
def download_and_extract_json_gz_asset(asset_name, dest):
    download_asset_by_name(asset_name, tmpdir)
    with utils.working_directory(tmpdir):
        with gzip.open(asset_name, "rt", encoding="utf-8") as file_in:
            with open(dest, "w") as file_out:
                shutil.copyfileobj(file_in, file_out)


################################################################################
# Get all releases from 4.11.0 onwards, that are not a draft or prerelease
utils.CURRENT_REPO_NAME = f"{args.gap_fork}/gap"
utils.initialize_github(args.token)
utils.notice(f"Will use temporary directory: {tmpdir}")

releases = [
    x for x in utils.CURRENT_REPO.get_releases()
    if not x.draft and not x.prerelease
    and utils.is_possible_gap_release_tag(x.tag_name) and (
        int(x.tag_name[1:].split('.')[0]) > 4 or (int(x.tag_name[1:].split(
            '.')[0]) == 4 and int(x.tag_name[1:].split('.')[1]) >= 11))
]
if releases:
    utils.notice(f"Found {len(releases)} published GAP releases >= v4.11.0")
else:
    utils.notice("Found no published GAP releases >= v4.11.0")
    sys.exit(0)

# Sort by version number, biggest to smallest