diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index 26bcf446cb..8d718b33d6 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -33,8 +33,7 @@ body: description: > We need to know a bit more about the context in which Snapcraft failed. - Are you running Snapcraft in destructive-mode, using LXD or Multipass. - - On what system is Snapcraft running (e.g.; Ubuntu 22.04 LTS, Windows 11, - OS X 10.15). + - On what system is Snapcraft running (e.g.; Ubuntu 24.04 LTS, OS X 10.15). validations: required: true - type: textarea diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7f4a447663..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,74 +0,0 @@ -image: Visual Studio 2019 -environment: - INNOCC: C:\Program Files (x86)\Inno Setup 6\iscc.exe - MAKEAPPX: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\makeappx.exe - SIGNTOOL: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\signtool.exe - SNAPCRAFT_INSTALLED_EXE: C:\Program Files (x86)\Snapcraft for Windows\snapcraft.exe - TIMESTAMP_SERVICE: http://timestamp.digicert.com - - matrix: - - PYTHON: C:\Python310-x64 - -cache: -- '%LOCALAPPDATA%\pip\Cache\http' -- '%LOCALAPPDATA%\pip\Cache\wheels' -build: off - -install: -- cmd: | - %PYTHON%\python.exe -m venv venv - venv\Scripts\activate.bat - python -c "import sys; print(sys.executable)" - python -m pip install -r requirements-devel.txt - python -m pip install --prefix %VIRTUAL_ENV% -e . - venv\Scripts\deactivate.bat - -build_script: -- cmd: | - echo "Building snapcraft.exe..." - venv\Scripts\activate.bat - pyinstaller.exe snapcraft.spec - venv\Scripts\deactivate.bat - - echo "Test signing snapcraft.exe..." - powershell.exe windows\generate-self-signed-cert.ps1 - "%SIGNTOOL%" sign /fd SHA256 /td SHA256 /tr "%TIMESTAMP_SERVICE%" /f test-signing.pfx /p Password1234 dist\snapcraft.exe - - echo "Setting Snapcraft version..." - venv\Scripts\activate.bat - python -m tools.version set-snapcraft-iss - venv\Scripts\deactivate.bat - echo "Building snapcraft inno installer..." - "%INNOCC%" windows\snapcraft.iss - - copy dist\snapcraft-installer.exe dist\snapcraft-installer-self-signed.exe - echo "Test signing snapcraft inno installer..." - "%SIGNTOOL%" sign /fd SHA256 /td SHA256 /tr "%TIMESTAMP_SERVICE%" /f test-signing.pfx /p Password1234 dist\snapcraft-installer-self-signed.exe - - echo "Building snapcraft msix installer..." - mkdir dist\msix - copy dist\snapcraft.exe dist\msix\ - copy windows\snapcraft.png dist\msix\ - copy windows\AppxManifest.xml dist\msix\ - "%MAKEAPPX%" pack /h SHA256 /d dist\msix /p dist\snapcraft-installer.msix - - echo "Test signing snapcraft msix installer..." - "%SIGNTOOL%" sign /fd SHA256 /td SHA256 /tr "%TIMESTAMP_SERVICE%" /f test-signing.pfx /p Password1234 dist\snapcraft-installer.msix - -test_script: -- cmd: | - echo "Smoke testing snapcraft.exe..." - dist\snapcraft.exe version - mkdir test - cd test - ..\dist\snapcraft.exe init - cd .. - - echo "Smoke testing snapcraft-installer-self-signed.exe..." - start /wait "SNAPCRAFT INSTALLER" dist\snapcraft-installer-self-signed.exe /VERYSILENT /ALLUSERS - "%SNAPCRAFT_INSTALLED_EXE%" version - -artifacts: -#- path: dist\snapcraft.exe -- path: dist\snapcraft-installer.exe -#- path: dist\snapcraft-installer.msix diff --git a/snapcraft.spec b/snapcraft.spec deleted file mode 100644 index b036c773aa..0000000000 --- a/snapcraft.spec +++ /dev/null @@ -1,62 +0,0 @@ -# -*- mode: python ; coding: utf-8 -*- -from PyInstaller.utils.hooks import collect_data_files, copy_metadata - -block_cipher = None - -data = [ - ("extensions", os.path.join("share", "snapcraft", "extensions")), - ("keyrings", os.path.join("share", "snapcraft", "keyrings")), - ("schema", os.path.join("share", "snapcraft", "schema")), - ] -data += collect_data_files("launchpadlib") -data += collect_data_files("lazr.restfulclient") -data += collect_data_files("lazr.uri") -data += collect_data_files("wadllib") -data += copy_metadata("launchpadlib") -data += copy_metadata("lazr.restfulclient") -data += copy_metadata("lazr.uri") -data += copy_metadata("wadllib") - -a = Analysis( - ["snapcraft\\__main__.py"], - pathex=[], - binaries=[], - datas=data, - hiddenimports=[ - "cffi", - "click", - "configparser", - "pkg_resources", - # Workaround PyInstaller & SetupTools, https://github.com/pypa/setuptools/issues/1963 - "pkg_resources.py2_warn", - "pymacaroons", - "responses", - ], - hookspath=[], - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False, -) - -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) - -exe = EXE( - pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - [], - name="snapcraft", - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - upx_exclude=[], - runtime_tmpdir=None, - console=True, - icon="windows/snapcraft.ico", -) diff --git a/tests/unit/store/test_client.py b/tests/unit/store/test_client.py index 359067bf9b..263d15a3e6 100644 --- a/tests/unit/store/test_client.py +++ b/tests/unit/store/test_client.py @@ -200,17 +200,6 @@ def test_useragent_linux_with_testing(monkeypatch, testing_env): ) -@pytest.mark.parametrize("testing_env", ("TRAVIS_TESTING", "AUTOPKGTEST_TMP")) -def test_useragent_windows_with_testing(monkeypatch, testing_env): - """Construct a user-agent as a patched Windows machine""" - monkeypatch.setenv(testing_env, "1") - os_platform = OSPlatform(system="Windows", release="10", machine="AMD64") - - assert client.build_user_agent(version="7.1.0", os_platform=os_platform) == ( - "snapcraft/7.1.0 (testing) Windows/10 (AMD64)" - ) - - ##################### # Store Environment # ##################### diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 3d9dbdd9e8..18fd311314 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -156,19 +156,6 @@ def test_get_os_platform_alternative_formats(tmp_path, mocker, name): assert os_platform.system == result -def test_get_os_platform_windows(mocker): - """Get platform from a patched Windows machine.""" - mocker.patch("platform.system", return_value="Windows") - mocker.patch("platform.release", return_value="10") - mocker.patch("platform.machine", return_value="AMD64") - - os_platform = utils.get_os_platform() - - assert os_platform.system == "Windows" - assert os_platform.release == "10" - assert os_platform.machine == "AMD64" - - @pytest.mark.parametrize( "platform_machine,platform_architecture,deb_arch", [ diff --git a/tools/freeze-requirements.sh b/tools/freeze-requirements.sh index c33eea2153..5abe5b4c51 100755 --- a/tools/freeze-requirements.sh +++ b/tools/freeze-requirements.sh @@ -9,12 +9,6 @@ requirements_fixups() { # https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463 sed -i '/pkg[-_]resources==0.0.0/d' "$req_file" - - # Pinned pyinstaller for windows. - if [[ "$req_file" == "requirements-devel.txt" ]]; then - sed -i '/pyinstaller/d' "$req_file" - echo 'pyinstaller==5.13.1; sys.platform == "win32"' >> "$req_file" - fi } venv_dir="$(mktemp -d)" diff --git a/tools/version.py b/tools/version.py index 672d508a92..16de5a3de8 100755 --- a/tools/version.py +++ b/tools/version.py @@ -59,21 +59,5 @@ def determine_version(): return f"{version}.post{distance}+git{commit[1:]}" -def set_snapcraft_iss(): - snapcraft_iss_path = pathlib.Path("windows/snapcraft.iss") - assert ( - snapcraft_iss_path.exists() - ), f"Run from project root and ensure {snapcraft_iss_path!s} exists." - with fileinput.input(str(snapcraft_iss_path), inplace=True) as iss_file: - for line in iss_file: - if line.startswith("AppVersion="): - print(f"AppVersion={determine_version()}") - else: - print(line, end="") - - if __name__ == "__main__": - if len(sys.argv) == 2 and sys.argv[1] == "set-snapcraft-iss": - set_snapcraft_iss() - else: - print(determine_version()) + print(determine_version()) diff --git a/windows/AppxManifest.xml b/windows/AppxManifest.xml deleted file mode 100644 index 8fc6d60afb..0000000000 --- a/windows/AppxManifest.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Snapcraft - Canonical Ltd. - snapcraft.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/windows/generate-self-signed-cert.ps1 b/windows/generate-self-signed-cert.ps1 deleted file mode 100644 index 3a4faac71b..0000000000 --- a/windows/generate-self-signed-cert.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -$cert = New-SelfSignedCertificate -Subject "CN=test-signing.snapcraft.io" -Type CodeSigning -CertStoreLocation "Cert:\CurrentUser\My" -$CertPassword = ConvertTo-SecureString -String "Password1234" -Force -AsPlainText -Export-PfxCertificate -Cert "cert:\CurrentUser\My\$($cert.Thumbprint)" -FilePath "test-signing.pfx" -Password $CertPassword \ No newline at end of file diff --git a/windows/modpath.iss b/windows/modpath.iss deleted file mode 100644 index 456d156a54..0000000000 --- a/windows/modpath.iss +++ /dev/null @@ -1,196 +0,0 @@ -// ---------------------------------------------------------------------------- -// -// Inno Setup Ver: 5.4.2 -// Script Version: 1.4.2 -// Author: Jared Breland -// Homepage: http://www.legroom.net/software -// License: GNU Lesser General Public License (LGPL), version 3 -// http://www.gnu.org/licenses/lgpl.html -// -// Script Function: -// Allow modification of environmental path directly from Inno Setup installers -// -// Instructions: -// Copy modpath.iss to the same directory as your setup script -// -// Add this statement to your [Setup] section -// ChangesEnvironment=true -// -// Add this statement to your [Tasks] section -// You can change the Description or Flags -// You can change the Name, but it must match the ModPathName setting below -// Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked -// -// Add the following to the end of your [Code] section -// ModPathName defines the name of the task defined above -// ModPathType defines whether the 'user' or 'system' path will be modified; -// this will default to user if anything other than system is set -// setArrayLength must specify the total number of dirs to be added -// Result[0] contains first directory, Result[1] contains second, etc. -// const -// ModPathName = 'modifypath'; -// ModPathType = 'user'; -// -// function ModPathDir(): TArrayOfString; -// begin -// setArrayLength(Result, 1); -// Result[0] := ExpandConstant('{app}'); -// end; -// #include "modpath.iss" -// ---------------------------------------------------------------------------- - -procedure ModPath(); -var - oldpath: String; - newpath: String; - updatepath: Boolean; - pathArr: TArrayOfString; - aExecFile: String; - aExecArr: TArrayOfString; - i, d: Integer; - pathdir: TArrayOfString; - regroot: Integer; - regpath: String; - -begin - // Get constants from main script and adjust behavior accordingly - // ModPathType MUST be 'system' or 'user'; force 'user' if invalid - if ModPathType = 'system' then begin - regroot := HKEY_LOCAL_MACHINE; - regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; - end else begin - regroot := HKEY_CURRENT_USER; - regpath := 'Environment'; - end; - - // Get array of new directories and act on each individually - pathdir := ModPathDir(); - for d := 0 to GetArrayLength(pathdir)-1 do begin - updatepath := true; - - // Modify WinNT path - if UsingWinNT() = true then begin - - // Get current path, split into an array - RegQueryStringValue(regroot, regpath, 'Path', oldpath); - oldpath := oldpath + ';'; - i := 0; - - while (Pos(';', oldpath) > 0) do begin - SetArrayLength(pathArr, i+1); - pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); - oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); - i := i + 1; - - // Check if current directory matches app dir - if pathdir[d] = pathArr[i-1] then begin - // if uninstalling, remove dir from path - if IsUninstaller() = true then begin - continue; - // if installing, flag that dir already exists in path - end else begin - updatepath := false; - end; - end; - - // Add current directory to new path - if i = 1 then begin - newpath := pathArr[i-1]; - end else begin - newpath := newpath + ';' + pathArr[i-1]; - end; - end; - - // Append app dir to path if not already included - if (IsUninstaller() = false) AND (updatepath = true) then - newpath := newpath + ';' + pathdir[d]; - - // Write new path - RegWriteStringValue(regroot, regpath, 'Path', newpath); - - // Modify Win9x path - end else begin - - // Convert to shortened dirname - pathdir[d] := GetShortName(pathdir[d]); - - // If autoexec.bat exists, check if app dir already exists in path - aExecFile := 'C:\AUTOEXEC.BAT'; - if FileExists(aExecFile) then begin - LoadStringsFromFile(aExecFile, aExecArr); - for i := 0 to GetArrayLength(aExecArr)-1 do begin - if IsUninstaller() = false then begin - // If app dir already exists while installing, skip add - if (Pos(pathdir[d], aExecArr[i]) > 0) then - updatepath := false; - break; - end else begin - // If app dir exists and = what we originally set, then delete at uninstall - if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then - aExecArr[i] := ''; - end; - end; - end; - - // If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path - if (IsUninstaller() = false) AND (updatepath = true) then begin - SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True); - - // If uninstalling, write the full autoexec out - end else begin - SaveStringsToFile(aExecFile, aExecArr, False); - end; - end; - end; -end; - -// Split a string into an array using passed delimiter -procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String); -var - i: Integer; -begin - i := 0; - repeat - SetArrayLength(Dest, i+1); - if Pos(Separator,Text) > 0 then begin - Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1); - Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text)); - i := i + 1; - end else begin - Dest[i] := Text; - Text := ''; - end; - until Length(Text)=0; -end; - -procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); -var - aSelectedTasks: TArrayOfString; - i: Integer; - taskname: String; - regpath: String; - regstring: String; - appid: String; -begin - // only run during actual uninstall - if CurUninstallStep = usUninstall then begin - // get list of selected tasks saved in registry at install time - appid := '{#emit SetupSetting("AppId")}'; - if appid = '' then appid := '{#emit SetupSetting("AppName")}'; - regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1'); - RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring); - if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring); - - // check each task; if matches modpath taskname, trigger patch removal - if regstring <> '' then begin - taskname := ModPathName; - MPExplode(aSelectedTasks, regstring, ','); - if GetArrayLength(aSelectedTasks) > 0 then begin - for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin - if comparetext(aSelectedTasks[i], taskname) = 0 then - ModPath(); - end; - end; - end; - end; -end; diff --git a/windows/snapcraft.ico b/windows/snapcraft.ico deleted file mode 100644 index fd0db9d042..0000000000 Binary files a/windows/snapcraft.ico and /dev/null differ diff --git a/windows/snapcraft.iss b/windows/snapcraft.iss deleted file mode 100644 index c00fbcd1f1..0000000000 --- a/windows/snapcraft.iss +++ /dev/null @@ -1,53 +0,0 @@ -[Setup] -AppId={{05E40DED-CE0A-437E-B90C-25A32B47880F} -AppName=Snapcraft (Preview) for Windows -AppVersion=VERSION -AppPublisher=Canonical Ltd. -AppPublisherURL=https://snapcraft.io/ -AppSupportURL=https://snapcraft.io/ -AppUpdatesURL=https://snapcraft.io/ -DefaultDirName={autopf}\Snapcraft for Windows -DisableProgramGroupPage=yes -LicenseFile=..\COPYING -PrivilegesRequired=lowest -PrivilegesRequiredOverridesAllowed=dialog -SetupIconFile=snapcraft.ico -Compression=lzma -SolidCompression=yes -WizardStyle=modern -OutputBaseFilename=snapcraft-installer -OutputDir=..\dist -ChangesEnvironment=yes - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Tasks] -Name: modifypath; Description: "Add snapcraft to the current user's PATH (Recommended)" - -[Files] -Source: "..\dist\snapcraft.exe"; DestDir: "{app}"; Flags: ignoreversion - -[Code] -const - ModPathName = 'modifypath'; - ModPathType = 'user'; - -function ModPathDir(): TArrayOfString; -begin - SetArrayLength(Result, 1); - Result[0] := ExpandConstant('{app}'); -end; -#include "modpath.iss" - -procedure CurStepChanged(CurStep: TSetupStep); -var - Success: Boolean; -begin - Success := True; - if CurStep = ssPostInstall then - begin - if WizardIsTaskSelected(ModPathName) then - ModPath(); - end; -end; diff --git a/windows/snapcraft.png b/windows/snapcraft.png deleted file mode 100644 index 3d7405d883..0000000000 Binary files a/windows/snapcraft.png and /dev/null differ