Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure project to make testing branches easier #102

Merged
merged 10 commits into from
Mar 31, 2019
Merged
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ msbuild.wrn
# Visual Studio 2015
.vs/


# Test caches
.pytest_cache/
.tox/
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ python:
sudo: false

env:
PYTHONPATH: plugin.video.vrt.nu
PYTHONPATH: .

install:
- pip install -r requirements.txt

script:
- tox
- pylint plugin.video.vrt.nu/*.py
- pylint plugin.video.vrt.nu/resources/lib/*/*.py
- python plugin.video.vrt.nu/vrtnutests/vrtplayertests.py
- pylint *.py
- pylint resources/lib/*/*.py
- python test/vrtplayertests.py
45 changes: 45 additions & 0 deletions Build-Zip.ps1
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
1 change: 0 additions & 1 deletion MakeZipWindows.bat

This file was deleted.

51 changes: 25 additions & 26 deletions Makefile
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.
12 changes: 0 additions & 12 deletions packagemaker/Packagemaker.csproj

This file was deleted.

129 changes: 0 additions & 129 deletions packagemaker/Program.cs

This file was deleted.

15 changes: 0 additions & 15 deletions packagemaker/Properties/PublishProfiles/FolderProfile.pubxml

This file was deleted.

4 changes: 1 addition & 3 deletions plugin.video.vrt.nu.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "plugin.video.vrt.nu", "plugin.video.vrt.nu\plugin.video.vrt.nu.pyproj", "{0360D216-8FEA-4853-AEF8-EBD17CD8B763}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Packagemaker", "packagemaker\Packagemaker.csproj", "{0400C90D-4756-4811-8AF1-CB921F0A83E9}"
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "plugin.video.vrt.nu.pyproj", "plugin.video.vrt.nu.pyproj", "{0360D216-8FEA-4853-AEF8-EBD17CD8B763}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
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.
Loading