Skip to content

Commit

Permalink
Update frameworks and remove Atom ide
Browse files Browse the repository at this point in the history
  • Loading branch information
LyzardKing committed Nov 24, 2022
1 parent d9d3a5f commit df1cf45
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 208 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/url_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
# * is a special character in YAML so you have to quote this string
- cron: '* * 1 * *'



jobs:
build:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def local_run(args):
else:
specified_config = True

if args.cache:
pytest_args.extend(["--last-failed"])

# check if we want to run those tests with the system code
if args.system:
# let remove it from there as well
Expand Down Expand Up @@ -134,6 +137,7 @@ if __name__ == '__main__':
"tests or tessuite")
config_group.add_argument("--debug", action="store_true", help="Force using debug profile even when running "
"all tests")
config_group.add_argument("--cache", action="store_true", help="Run only previously failed tests")

# set local as default and parse
cmd = sys.argv[1:]
Expand Down
83 changes: 0 additions & 83 deletions tests/large/test_ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,89 +531,6 @@ def test_default_install(self):
self.wait_and_close()


class AtomTests(LargeFrameworkTests):
"""Tests for Atom"""

TIMEOUT_INSTALL_PROGRESS = 120
TIMEOUT_START = 20
TIMEOUT_STOP = 20

def setUp(self):
super().setUp()
self.installed_path = os.path.join(self.install_base_path, "ide", "atom")
self.desktop_filename = "atom.desktop"
self.command_args = '{} ide atom'.format(UMAKE)
self.name = "Atom"

def test_default_install(self):
"""Install Atom from scratch test case"""

self.child = spawn_process(self.command(self.command_args))
self.expect_and_no_warn(r"Choose installation path: {}".format(self.installed_path))
self.child.sendline("")
self.expect_and_no_warn(r"Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
self.wait_and_close()

# we have an installed launcher, added to the launcher and an icon file
self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
self.assert_exec_exists()
self.assert_icon_exists()
self.assert_exec_link_exists()
# Test if the apm symlink is added correctly:
self.assertTrue(self.is_in_path(os.path.join(self.install_base_path, 'bin', 'apm')))

# launch it, send SIGTERM and check that it exits fine
proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)

self.check_and_kill_process(["atom", self.installed_path],
wait_before=self.TIMEOUT_START, send_sigkill=True)
proc.communicate()
proc.wait(self.TIMEOUT_STOP)

# ensure that it's detected as installed:
self.child = spawn_process(self.command(self.command_args))
self.expect_and_no_warn(r"{} is already installed.*\[.*\] ".format(self.name))
self.child.sendline()
self.wait_and_close()

def test_beta_install(self):
"""Install Atom from scratch test case"""
self.installed_path += '-beta'
self.desktop_filename = self.desktop_filename.replace('.desktop', '-beta.desktop')
self.command_args += ' --beta'
self.name += ' Beta'

self.child = spawn_process(self.command(self.command_args))
self.expect_and_no_warn(r"Choose installation path: {}".format(self.installed_path))
self.child.sendline("")
self.expect_and_no_warn(r"Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
self.wait_and_close()

# we have an installed launcher, added to the launcher and an icon file
self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
self.assert_exec_exists()
self.assert_icon_exists()
self.assert_exec_link_exists()
# Test if the apm symlink is added correctly:
self.assertTrue(self.is_in_path(os.path.join(self.install_base_path, 'bin', 'apm')))

# launch it, send SIGTERM and check that it exits fine
proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)

self.check_and_kill_process(["atom", self.installed_path],
wait_before=self.TIMEOUT_START, send_sigkill=True)
proc.communicate()
proc.wait(self.TIMEOUT_STOP)

# ensure that it's detected as installed:
self.child = spawn_process(self.command(self.command_args))
self.expect_and_no_warn(r"{} is already installed.*\[.*\] ".format(self.name))
self.child.sendline()
self.wait_and_close()


class DBeaverTests(LargeFrameworkTests):
"""Tests for DBeaver"""

Expand Down
5 changes: 0 additions & 5 deletions tests/large/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ def test_go_lang_install(self):
self.child = spawn_process(self.command(f'{UMAKE} go go-lang --dry-run'))
self.expect_and_no_warn("Found download URL:.*")

def test_atom_install(self):
"""Install base installer from scratch test case"""
self.child = spawn_process(self.command(f'{UMAKE} ide atom --dry-run'))
self.expect_and_no_warn("Found download URL:.*")

def test_clion_install(self):
"""Install base installer from scratch test case"""
self.child = spawn_process(self.command(f'{UMAKE} ide clion --dry-run'))
Expand Down
34 changes: 0 additions & 34 deletions tests/medium/test_ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,40 +389,6 @@ def test_install_with_changed_download_page(self):
self.assertFalse(self.is_in_path(self.exec_link))


class AtomInContainer(ContainerTests, test_ide.AtomTests):
"""This will test the Atom integration inside a container"""

TIMEOUT_START = 20
TIMEOUT_STOP = 10

def setUp(self):
self.hosts = {443: ["api.github.com", "github.com"]}
self.apt_repo_override_path = os.path.join(self.APT_FAKE_REPO_PATH, 'atom')
super().setUp()
# override with container path
self.installed_path = os.path.join(self.install_base_path, "ide", "atom")

def test_install_with_changed_download_page(self):
"""Installing Atom should fail if download page has significantly changed"""
download_page_file_path = os.path.join(get_data_dir(), "server-content", "api.github.com",
"repos", "Atom", "Atom", "releases", "latest")
umake_command = self.command('{} ide atom'.format(UMAKE))
self.bad_download_page_test(self.command(self.command_args), download_page_file_path)
self.assertFalse(self.launcher_exists_and_is_pinned(self.desktop_filename))
self.assertFalse(self.is_in_path(self.exec_link))

def test_install_beta_with_changed_download_page(self):
"""Installing Atom Beta should fail if the latest is not a beta"""
download_page_file_path = os.path.join(get_data_dir(), "server-content", "api.github.com",
"repos", "Atom", "Atom", "releases", "index.html")
with swap_file_and_restore(download_page_file_path) as content:
with open(download_page_file_path, "w") as newfile:
newfile.write(content.replace("-beta", ""))
self.child = umake_command = self.command('{} ide atom --beta'.format(UMAKE))
self.assertFalse(self.launcher_exists_and_is_pinned(self.desktop_filename))
self.assertFalse(self.is_in_path(self.exec_link))


class SublimeTextInContainer(ContainerTests, test_ide.SublimeTextTests):
"""This will test the Sublime Text integration inside a container"""

Expand Down
24 changes: 14 additions & 10 deletions umake/frameworks/dart.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
from gettext import gettext as _
import logging
import os
import re
import umake.frameworks.baseinstaller
from umake.interactions import DisplayMessage
from umake.network.download_center import DownloadCenter, DownloadItem
from umake.tools import add_env_to_user, get_current_arch
from umake.ui import UI

logger = logging.getLogger(__name__)

_supported_archs = ['i386', 'amd64']
_supported_archs = ['i386', 'amd64', 'armhf', 'aarch64']


class DartCategory(umake.frameworks.BaseCategory):
Expand Down Expand Up @@ -59,8 +61,9 @@ def __init__(self, **kwargs):

arch_trans = {
"amd64": "x64",
"i386": "ia32"
# TODO: add arm
"i386": "ia32",
"aarch64": "arm64",
"armhf": "arm"
}

def parse_download_link(self, line, in_download):
Expand All @@ -82,19 +85,20 @@ class FlutterLang(umake.frameworks.baseinstaller.BaseInstaller):
def __init__(self, **kwargs):
super().__init__(name="Flutter SDK", description=_("Flutter SDK"),
only_on_archs=_supported_archs,
download_page="https://storage.googleapis.com/flutter_infra/releases/releases_linux.json",
download_page="https://raw.githubusercontent.com/wiki/flutter/flutter/Hotfixes-to-the-Stable-Channel.md",
dir_to_decompress_in_tarball="flutter",
required_files_path=[os.path.join("bin", "flutter")],
json=True, **kwargs)
packages_requirements=["libglu1-mesa"],
**kwargs)

def parse_download_link(self, line, in_download):
"""Parse Flutter SDK download links"""
url = None
for asset in line["releases"]:
if "linux" in asset["archive"] and "stable" in asset["archive"]:
in_download = True
url = self.download_page.rsplit("/", 1)[0] + "/" + asset["archive"]
return (url, in_download)
if "flutter/releases/tag" in line:
in_download = True
url = "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/" +\
"flutter_linux_{}-stable.tar.xz".format(re.findall("\[(.*)\]", line)[0])
return ((url, None), in_download)

def post_install(self):
"""Add flutter necessary env variables"""
Expand Down
7 changes: 4 additions & 3 deletions umake/frameworks/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,16 @@ def __init__(self, **kwargs):
self.icon_name = 'twine.svg'

arch_trans = {
"amd64": "64",
"i386": "32"
"amd64": "x64",
"aarch64": "arm64",
"i386": "ia32"
}

def parse_download_link(self, line, in_download):
"""Parse Twine download links"""
url = None
for asset in line["assets"]:
if 'linux{}'.format(self.arch_trans[get_current_arch()]) in asset["browser_download_url"]:
if 'Linux-{}.zip'.format(self.arch_trans[get_current_arch()]) in asset["browser_download_url"]:
in_download = True
url = asset["browser_download_url"]
return (url, in_download)
Expand Down
67 changes: 7 additions & 60 deletions umake/frameworks/ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,47 +598,8 @@ def post_install(self):
class Atom(umake.frameworks.baseinstaller.BaseInstaller):

def __init__(self, **kwargs):
super().__init__(name="Atom", description=_("The hackable text editor"),
only_on_archs=['amd64'],
download_page="https://api.github.com/repos/Atom/Atom/releases/latest",
desktop_filename="atom.desktop",
required_files_path=["atom", "resources/app/apm/bin/apm"],
dir_to_decompress_in_tarball="atom-*",
packages_requirements=["libgconf-2-4"],
json=True, **kwargs)

def parse_download_link(self, line, in_download):
url = None
for asset in line["assets"]:
if "tar.gz" in asset["browser_download_url"]:
in_download = True
url = asset["browser_download_url"]
return (url, in_download)

def post_install(self):
"""Create the Atom Code launcher"""
# Add apm to PATH
create_launcher(self.desktop_filename, get_application_desktop_file(name=_("Atom"),
icon_path=os.path.join(self.install_path, "atom.png"),
try_exec=self.exec_path,
exec=self.exec_link_name,
comment=_("The hackable text editor"),
categories="Development;IDE;"))

def install_framework_parser(self, parser):
this_framework_parser = super().install_framework_parser(parser)
this_framework_parser.add_argument('--beta', action="store_true",
help=_("Install Beta version if available"))
return this_framework_parser

def run_for(self, args):
if args.beta:
self.name += " Beta"
self.description += " beta"
self.desktop_filename = self.desktop_filename.replace(".desktop", "-beta.desktop")
self.download_page = "https://api.github.com/repos/Atom/Atom/releases"
self.install_path += "-beta"
super().run_for(args)
super().__init__(name="Atom", description=_("The hackable text editor (not supported upstream anymore)"),
download_page=None, only_on_archs=['amd64'], only_for_removal=True, **kwargs)


class DBeaver(umake.frameworks.baseinstaller.BaseInstaller):
Expand Down Expand Up @@ -680,7 +641,7 @@ class SublimeText(umake.frameworks.baseinstaller.BaseInstaller):
def __init__(self, **kwargs):
super().__init__(name="Sublime Text", description=_("Sophisticated text editor for code, markup and prose"),
only_on_archs=['amd64', 'aarch64'],
download_page="https://sublimetext.com/download",
download_page="https://www.sublimetext.com/download_thanks",
desktop_filename="sublime-text.desktop",
required_files_path=["sublime_text"],
dir_to_decompress_in_tarball="sublime_text",
Expand All @@ -694,7 +655,7 @@ def __init__(self, **kwargs):
def parse_download_link(self, line, in_download):
"""Parse SublimeText download links"""
url = None
if '.tar.xz' in line:
if '{}.tar.xz'.format(self.arch_trans[get_current_arch()]) in line:
p = re.search(r'href="([^<]*{}.tar.xz)"'.format(self.arch_trans[get_current_arch()]), line)
with suppress(AttributeError):
url = p.group(1)
Expand Down Expand Up @@ -733,7 +694,7 @@ def parse_download_link(self, line, in_download):
else:
in_download = False
if in_download:
p = re.search(r'href="(.*.tar.gz)"', line)
p = re.search(r'href="(.+?.tar.gz)"', line)
with suppress(AttributeError):
# url set to check in baseinstaller if missing
url = p.group(1) + '.sha1'
Expand Down Expand Up @@ -835,23 +796,14 @@ class RStudio(umake.frameworks.baseinstaller.BaseInstaller):
def __init__(self, **kwargs):
super().__init__(name="RStudio", description=_("RStudio code editor"),
only_on_archs=['amd64'],
download_page="https://www.rstudio.com/products/rstudio/download/",
packages_requirements=["libjpeg62", "libedit2", "libssl1.0.0 | libssl1.0.3 | libssl1.1",
download_page="https://posit.co/download/rstudio-desktop/",
packages_requirements=["libjpeg62", "libedit2", "libssl1.1 | libssl3",
"libclang-dev", "libpq5", "r-base"],
desktop_filename="rstudio.desktop",
required_files_path=["bin/rstudio"],
dir_to_decompress_in_tarball="rstudio-*",
checksum_type=ChecksumType.sha256,
**kwargs)

self.headers = {'User-agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu "
"Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36"}

def download_provider_page(self):
logger.debug("Download application provider page")
DownloadCenter([DownloadItem(self.download_page, headers=self.headers)],
self.get_metadata_and_check_license, download=False)

def parse_download_link(self, line, in_download):
"""Parse RStudio download links"""
url = None
Expand All @@ -864,11 +816,6 @@ def parse_download_link(self, line, in_download):
p = re.search(r'href=\"([^<]*{}.*-debian\.tar\.gz)\"'.format(ubuntu_version), line)
with suppress(AttributeError):
url = p.group(1)
in_download = True
if in_download and 'data-ls-toggle="popover"' in line:
p = re.search('data-content="(.*)">', line)
with suppress(AttributeError):
checksum = p.group(1)
return ((url, checksum), in_download)

def post_install(self):
Expand Down
Loading

0 comments on commit df1cf45

Please sign in to comment.