-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure project to make testing branches easier (#102)
* Restructure project so GitHub zip files work out-of-the-box * Fix Travis CI too * Add MakeZipWindows.ps1 PowerShell script * Exclude common globs * Attempt to rewrite .pyproj file * Improve Makefile as well * Exclude the right stuff * Silence! * Fix for PowerShell 5 and colorized output * Fix Windows path-separator in ZIP files
- Loading branch information
Showing
48 changed files
with
75 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ msbuild.wrn | |
# Visual Studio 2015 | ||
.vs/ | ||
|
||
|
||
# Test caches | ||
.pytest_cache/ | ||
.tox/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env pwsh | ||
|
||
Set-StrictMode -Version 5.0 | ||
|
||
$include_files = @( 'addon.py', 'addon.xml', 'LICENSE', 'README.md', 'service.py' ) | ||
$include_paths = @( 'resources/' ) | ||
$exclude_files = @( '*.new', '*.orig', '*.pyc' ) | ||
|
||
# Get addon metadata | ||
[xml]$XmlDocument = Get-Content -LiteralPath 'addon.xml' | ||
$name = $XmlDocument.addon.id | ||
$version = $XmlDocument.addon.version | ||
$git_hash = Invoke-Expression 'git rev-parse --short HEAD' | ||
$zip_name = "$name-$version-$git_hash.zip" | ||
|
||
# Remove file if it exists | ||
if (Test-Path -LiteralPath $zip_name) { | ||
Remove-Item -LiteralPath $zip_name | ||
} | ||
|
||
# Ensure .NET's current directory is Powershell's working directory | ||
# NOTE: This is to ensure .NET can find our files correctly | ||
[System.IO.Directory]::SetCurrentDirectory($PWD) | ||
|
||
Add-Type -AssemblyName System.IO.Compression.FileSystem | ||
|
||
# Create ZIP file | ||
Write-Host -fore blue '= Building new package' | ||
$zip_file = [System.IO.Compression.ZipFile]::Open($zip_name, 'Create') | ||
ForEach ($relative_file in $include_files) { | ||
# NOTE: Avoid Windows path-separator in ZIP files | ||
$archive_file = (Join-Path -Path $name -ChildPath $relative_file).Replace('\', '/') | ||
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip_file, $relative_file, $archive_file) | ||
} | ||
ForEach ($path in $include_paths) { | ||
Get-ChildItem -Recurse -File -Path $path -Exclude $exclude_files | ForEach-Object { | ||
$relative_file = Resolve-Path -Path $_.FullName -Relative | ||
# NOTE: Powershell lacks functionality to normalize a path and uses Windows path-separator in ZIP files | ||
$archive_file = (Join-Path -Path $name -ChildPath $relative_file).Replace('\', '/').Replace('/./', '/') | ||
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip_file, $relative_file, $archive_file) | ||
} | ||
} | ||
$zip_file.Dispose() | ||
Write-Host "= Successfully wrote package as: " -ForegroundColor:Blue -NoNewLine | ||
Write-Host "$zip_name" -ForegroundColor:Cyan |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,42 @@ | ||
ENVS := py27,py36 | ||
|
||
addon_xml = plugin.video.vrt.nu/addon.xml | ||
addon_xml = addon.xml | ||
|
||
# Collect information to build as sensible package name | ||
name = $(shell xmllint --xpath 'string(/addon/@id)' $(addon_xml)) | ||
version = $(shell xmllint --xpath 'string(/addon/@version)' $(addon_xml)) | ||
git_hash = $(shell git rev-parse --short HEAD) | ||
|
||
zip_name = $(name)-$(version)-$(git_hash).zip | ||
exclude_files = $(name).pyproj vrtnutests/ vrtnutests/* | ||
exclude_paths = $(patsubst %,$(name)/%,$(exclude_files)) | ||
include_files = LICENSE README.md | ||
include_files = addon.py addon.xml LICENSE README.md resources/ service.py | ||
include_paths = $(patsubst %,$(name)/%,$(include_files)) | ||
exclude_files = \*.new \*.orig \*.pyc | ||
zip_dir = $(name)/ | ||
|
||
blue = \e[1;34m | ||
white = \e[1;37m | ||
reset = \e[0m | ||
|
||
.PHONY: test | ||
|
||
package: zip | ||
|
||
clean: | ||
@echo -e "\e[1;37m=\e[1;34m Clean up project directory\e[0m" | ||
find . -name '*.pyc' -delete | ||
@echo -e "\e[1;37m=\e[1;34m Finished cleaning up.\e[0m" | ||
test: sanity unit | ||
|
||
test: unittest | ||
@echo -e "\e[1;37m=\e[1;34m Starting tests\e[0m" | ||
pylint $(name)/*.py | ||
pylint $(name)/resources/lib/*/*.py | ||
sanity: | ||
@echo -e "$(white)=$(blue) Starting sanity tests$(reset)" | ||
pylint *.py | ||
pylint resources/lib/*/*.py | ||
tox -e $(ENVS) | ||
@echo -e "\e[1;37m=\e[1;34m Tests finished successfully.\e[0m" | ||
|
||
unittest: | ||
@echo -e "\e[1;37m=\e[1;34m Starting unit tests\e[0m" | ||
PYTHONPATH=$(name) python $(name)/vrtnutests/vrtplayertests.py | ||
@echo -e "\e[1;37m=\e[1;34m Unit tests finished successfully.\e[0m" | ||
|
||
zip: test clean | ||
@echo -e "\e[1;37m=\e[1;34m Building new package\e[0m" | ||
rm -f $(zip_name) | ||
cp -v $(include_files) $(zip_dir) | ||
zip -r $(zip_name) $(zip_dir) -x $(exclude_paths) | ||
cd $(zip_dir); rm -vf $(include_files) | ||
@echo -e "\e[1;37m=\e[1;34m Successfully wrote package as: \e[1;37m$(zip_name)\e[0m" | ||
@echo -e "$(white)=$(blue) Sanity tests finished successfully.$(reset)" | ||
|
||
unit: | ||
@echo -e "$(white)=$(blue) Starting unit tests$(reset)" | ||
PYTHONPATH=$(pwd) python test/vrtplayertests.py | ||
@echo -e "$(white)=$(blue) Unit tests finished successfully.$(reset)" | ||
|
||
zip: test | ||
@echo -e "$(white)=$(blue) Building new package$(reset)" | ||
@rm -f ../$(zip_name) | ||
cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files) | ||
@echo -e "$(white)=$(blue) Successfully wrote package as: $(white)../$(zip_name)$(reset)" |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
packagemaker/Properties/PublishProfiles/FolderProfile.pubxml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.