Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*.egg-info

/packaging/innosetup/.extensions
/packaging/choco/*/*-generated
/packaging/choco/*/*.generated.nuspec

# Caches
__pycache__
Expand Down
17 changes: 9 additions & 8 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"recommendations": [
"chouzz.vscode-innosetup",
"davidanson.vscode-markdownlint",
"ms-python.debugpy",
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff"
]
"recommendations": [
"chouzz.vscode-innosetup",
"davidanson.vscode-markdownlint",
"ms-python.debugpy",
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"ms-vscode.powershell"
]
}
34 changes: 34 additions & 0 deletions README_choco.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
VCF Generator Lite can convert a contact list into a single vCard file, which can be batch-imported into mobile phone
contacts or used for other purposes.

## Features

- **Smart Parsing**: Batch contacts in `Name Phone Note` format (note optional), automatically handles tabs and spaces.
- **Batch Generation**: Combines all contacts into a single `.vcf` file.
- **Number Validation**: Automatically skips invalid numbers and quickly locates error rows.
- **Editing Assistance**: Displays line numbers in text area, supports one-click quote removal.

## Usage

1. Copy the name and phone number in the format of `Name Phone Note` on each line into the text field below. The note
can be omitted.
```text
Isaac Newton 13445467890 British mathematician
Muhammad 13554678907
Confucius 13645436748
```
2. Click **Generate**, select a path to save the file.
3. You can use the generated vCard file wherever you need it.

> [!NOTE]
>
> - You can use both tabs and spaces to separate the name and phone number.
> - The program will automatically remove extra spaces from the text field.
>
> For example, ` Han Meimei 13333333333 A well-known girl` will be recognized as
>
>
> > - Name: Han Meimei
> > - Phone: 13333333333
> > - Note: A well-known girl
>
5 changes: 5 additions & 0 deletions packaging/choco/installable/tools-template/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
From: $dynamic:{license_url}

LICENSE

$dynamic:{license_content}
8 changes: 8 additions & 0 deletions packaging/choco/installable/tools-template/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

1. Download the following file from https://gitee.com/hellotool/VCFGeneratorLiteWithTkinter/releases/v$dynamic:{version_wheel}:
- $dynamic:{installer_filename}
2. Use any tool to verify the file information.
- SHA 256: $dynamic:{installer_sha256}
18 changes: 18 additions & 0 deletions packaging/choco/installable/tools-template/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$ErrorActionPreference = 'Stop'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir '$dynamic:{installer_filename}'


$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'exe'
file = $fileLocation
checksum64 = '$dynamic:{installer_sha256}'
checksumType64 = 'sha256'
silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup
validExitCodes = @(0)
}

Install-ChocolateyInstallPackage @packageArgs
Remove-Item $toolsDir\*.exe -ea 0 -force
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

44 changes: 44 additions & 0 deletions packaging/choco/installable/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file:
# $f='c:\path\to\thisFile.ps1'
# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f

## NOTE: In 80-90% of the cases (95% with licensed versions due to Package Synchronizer and other enhancements),
## AutoUninstaller should be able to detect and handle registry uninstalls without a chocolateyUninstall.ps1.
## See https://docs.chocolatey.org/en-us/choco/commands/uninstall
## and https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateypackage

## If this is an MSI, ensure 'softwareName' is appropriate, then clean up comments and you are done.
## If this is an exe, change fileType, silentArgs, and validExitCodes

$ErrorActionPreference = 'Stop' # stop on all errors
$packageArgs = @{
packageName = $env:ChocolateyPackageName
softwareNames = @('VCF 生成器 Lite', 'VCF Generator Lite')
fileType = 'EXE'
silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-'
validExitCodes = @(0)
}

$foundKeys = @()
foreach ($softwareName in $packageArgs['softwareNames']) {
[array]$keys = Get-UninstallRegistryKey -SoftwareName $softwareName
if ($keys.Count -gt 0) {
$foundKeys += $keys
}
}

if ($foundKeys.Count -eq 1) {
$foundKeys | ForEach-Object {
$packageArgs['file'] = "$($_.UninstallString)" #NOTE: You may need to split this if it contains spaces, see below
Uninstall-ChocolateyPackage @packageArgs
}
}
elseif ($foundKeys.Count -eq 0) {
Write-Warning "$packageName has already been uninstalled by other means."
}
elseif ($foundKeys.Count -gt 1) {
Write-Warning "$($foundKeys.Count) matches found!"
Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
Write-Warning "Please alert package maintainer the following keys were matched:"
$foundKeys | ForEach-Object { Write-Warning "- $($_.DisplayName)" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter
enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<id>vcf-generator-lite.install</id>
<version>$dynamic:{version_windows}</version>
<packageSourceUrl>$dynamic:{repository_url}</packageSourceUrl>
<owners>$dynamic:{author}</owners>
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<title>$dynamic:{display_name} (Install)</title>
<authors>$dynamic:{author}</authors>
<projectUrl>$dynamic:{repository_url}</projectUrl>
<iconUrl>$dynamic:{icon_url_cdn}</iconUrl>
<copyright>$dynamic:{copyright}</copyright>
<licenseUrl>$dynamic:{license_url}</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<projectSourceUrl>$dynamic:{repository_url}</projectSourceUrl>
<bugTrackerUrl>$dynamic:{bug_tracker_url}</bugTrackerUrl>
<tags>vcf-generator make-vcf vcf vcard-generator make-vcard vcard contacts</tags>
<summary>$dynamic:{summary}</summary>
<description>$dynamic:{description}</description>
<!-- =============================== -->
</metadata>
<files>
<file src="tools\**" target="tools" />
<file src="tools-generated\**" target="tools" />

<!-- Include the setup executable -->
<file src="..\..\..\dist\$dynamic:{installer_filename}" target="tools" />
</files>
</package>
9 changes: 9 additions & 0 deletions packaging/choco/meta/tools/chocolateybeforemodify.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This runs before upgrade or uninstall.
# Use this file to do things like stop services prior to upgrade or uninstall.
# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you
# need to uninstall an MSI prior to upgrade, put the functionality in this
# file without calling the uninstall script. Make it idempotent in the
# uninstall script so that it doesn't fail when it is already uninstalled.
# NOTE: For upgrades - like the uninstall script, this script always runs from
# the currently installed version, not from the new upgraded package version.

136 changes: 136 additions & 0 deletions packaging/choco/meta/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file:
# $f='c:\path\to\thisFile.ps1'
# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f

$ErrorActionPreference = 'Stop' # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
# Internal packages (organizations) or software that has redistribution rights (community repo)
# - Use `Install-ChocolateyInstallPackage` instead of `Install-ChocolateyPackage`
# and put the binaries directly into the tools folder (we call it embedding)
$fileLocation = Join-Path $toolsDir '{installer_filename}'
# If embedding binaries increase total nupkg size to over 1GB, use share location or download from urls
#$fileLocation = '\\SHARE_LOCATION\to\INSTALLER_FILE'
# Community Repo: Use official urls for non-redist binaries or redist where total package size is over 200MB
# Internal/Organization: Download from internal location (internet sources are unreliable)
$url = '' # download url, HTTPS preferred
$url64 = '' # 64bit URL here (HTTPS preferred) or remove - if installer contains both (very rare), use $url

$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'EXE_MSI_OR_MSU' #only one of these: exe, msi, msu
url = $url
url64bit = $url64
file = $fileLocation

softwareName = 'vcf-generator-lite*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique

# Checksums are required for packages which will be hosted on the Chocolatey Community Repository.
# To determine checksums, you can get that from the original site if provided.
# You can also use checksum.exe (choco install checksum) and use it
# e.g. checksum -t sha256 -f path\to\file
checksum = ''
checksumType = 'sha256' #default is md5, can also be sha1, sha256 or sha512
checksum64 = ''
checksumType64= 'sha256' #default is checksumType

# MSI
# silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
validExitCodes= @(0, 3010, 1641)
# OTHERS
# Uncomment matching EXE type (sorted by most to least common)
#silentArgs = '/S' # NSIS
#silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup
#silentArgs = '/s' # InstallShield
#silentArgs = '/s /v"/qn"' # InstallShield with MSI
#silentArgs = '/s' # Wise InstallMaster
#silentArgs = '-s' # Squirrel
#silentArgs = '-q' # Install4j
#silentArgs = '-s' # Ghost
# Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence.
#silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK)
# https://community.chocolatey.org/packages/autohotkey.portable
#validExitCodes= @(0) #please insert other valid exit codes here
}

# Install-ChocolateyPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateypackage
#Install-ChocolateyZipPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateyzippackage
## If you are making your own internal packages (organizations), you can embed the installer or
## put on internal file share and use the following instead (you'll need to add $file to the above)
# Install-ChocolateyInstallPackage @packageArgs # https://docs.chocolatey.org/en-us/create/functions/install-chocolateyinstallpackage

## Main helper functions - these have error handling tucked into them already
## see https://docs.chocolatey.org/en-us/create/functions

## Install an application, will assert administrative rights
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateypackage
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyinstallpackage
## add additional optional arguments as necessary
##Install-ChocolateyPackage $packageName $fileType $silentArgs $url [$url64 -validExitCodes $validExitCodes -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64]

## Download and unpack a zip file - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyzippackage
##Install-ChocolateyZipPackage $packageName $url $toolsDir [$url64 -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64]

## Install Visual Studio Package - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyvsixpackage
#Install-ChocolateyVsixPackage $packageName $url [$vsVersion] [-checksum $checksum -checksumType $checksumType]
#Install-ChocolateyVsixPackage @packageArgs

## see the full list at https://docs.chocolatey.org/en-us/create/functions

## downloader that the main helpers use to download items
## if removing $url64, please remove from here
## - https://docs.chocolatey.org/en-us/create/functions/get-chocolateywebfile
#Get-ChocolateyWebFile $packageName 'DOWNLOAD_TO_FILE_FULL_PATH' $url $url64

## Installer, will assert administrative rights - used by Install-ChocolateyPackage
## use this for embedding installers in the package when not going to community feed or when you have distribution rights
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyinstallpackage
#Install-ChocolateyInstallPackage $packageName $fileType $silentArgs '_FULLFILEPATH_' -validExitCodes $validExitCodes

## Unzips a file to the specified location - auto overwrites existing content
## - https://docs.chocolatey.org/en-us/create/functions/get-chocolateyunzip
#Get-ChocolateyUnzip "FULL_LOCATION_TO_ZIP.zip" $toolsDir

## Runs processes asserting UAC, will assert administrative rights - used by Install-ChocolateyInstallPackage
## - https://docs.chocolatey.org/en-us/create/functions/start-chocolateyprocessasadmin
#Start-ChocolateyProcessAsAdmin 'STATEMENTS_TO_RUN' 'Optional_Application_If_Not_PowerShell' -validExitCodes $validExitCodes

## To avoid quoting issues, you can also assemble your -Statements in another variable and pass it in
#$appPath = "$env:ProgramFiles\appname"
##Will resolve to C:\Program Files\appname
#$statementsToRun = "/C `"$appPath\bin\installservice.bat`""
#Start-ChocolateyProcessAsAdmin $statementsToRun cmd -validExitCodes $validExitCodes

## add specific folders to the path - any executables found in the chocolatey package
## folder will already be on the path. This is used in addition to that or for cases
## when a native installer doesn't add things to the path.
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateypath
#Install-ChocolateyPath 'LOCATION_TO_ADD_TO_PATH' 'User_OR_Machine' # Machine will assert administrative rights

## Add specific files as shortcuts to the desktop
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyshortcut
#$target = Join-Path $toolsDir "$($packageName).exe"
# Install-ChocolateyShortcut -shortcutFilePath "<path>" -targetPath "<path>" [-workingDirectory "C:\" -arguments "C:\test.txt" -iconLocation "C:\test.ico" -description "This is the description"]

## Outputs the bitness of the OS (either "32" or "64")
## - https://docs.chocolatey.org/en-us/create/functions/get-osarchitecturewidth
#$osBitness = Get-ProcessorBits

## Set persistent Environment variables
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyenvironmentvariable
#Install-ChocolateyEnvironmentVariable -variableName "SOMEVAR" -variableValue "value" [-variableType = 'Machine' #Defaults to 'User']

## Set up a file association
## - https://docs.chocolatey.org/en-us/create/functions/install-chocolateyfileassociation
#Install-ChocolateyFileAssociation

## Adding a shim when not automatically found - Chocolatey automatically shims exe files found in package directory.
## - https://docs.chocolatey.org/en-us/create/functions/install-binfile
## - https://docs.chocolatey.org/en-us/create/create-packages#how-do-i-exclude-executables-from-getting-shims
#Install-BinFile

##PORTABLE EXAMPLE
#$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
# despite the name "Install-ChocolateyZipPackage" this also works with 7z archives
#Install-ChocolateyZipPackage $packageName $url $toolsDir $url64
## END PORTABLE EXAMPLE
Loading