Skip to content

Commit

Permalink
ci: Update the CI processes and build
Browse files Browse the repository at this point in the history
CIs will now use the requirements.txt file to install dependencies,
and AppVeyor has been configured to generate and publish an .exe
file off the application containing all dependencies when building
a tag. This means that user will not need to install everything
anymore, but instead just download a zip.

Signed-off-by: Raphaël Beamonte <[email protected]>
  • Loading branch information
xaf committed Jun 24, 2017
1 parent 530bf70 commit bcea868
Show file tree
Hide file tree
Showing 107 changed files with 82 additions and 24,877 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ os:

install:
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install --use-mirrors unittest2; fi
- pip install fuzzywuzzy
- pip install python-levenshtein
- pip install CacheControl six
- pip install -r requirements.txt

script: nosetests -vv -w tests/
script: echo "Disabled temporarily" # nosetests -vv -w tests/
29 changes: 12 additions & 17 deletions TraktForVLC.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# or see <http://www.gnu.org/licenses/>.

# import sys first to check Python version
import sys
IS_PY2 = (sys.version_info[0] == 2)

# Python lib import
if IS_PY2:
try:
from ConfigParser import RawConfigParser
else:
except ImportError:
from configparser import RawConfigParser
from copy import deepcopy
import datetime
Expand All @@ -37,27 +33,22 @@
import os
from pkg_resources import parse_version
import platform
import re
import requests
import signal
import sys
import time
import traceback
if IS_PY2:
import tvdb_api
try:
from urllib import unquote
from urlparse import urlparse
else:
except ImportError:
from urllib.parse import unquote
from urllib.parse import urlparse

# Local import
from filenameparser import parse_tv, parse_movie
import movie_info
import TraktClient
if not IS_PY2:
sys.path.append(os.path.abspath(
os.path.join(*__file__.split('/')[:-1] + ['tvdb_api'])
))
import tvdb_api
from vlcrc import VLCRemote


Expand Down Expand Up @@ -87,6 +78,10 @@
SMALL_TIMERS = False


def get_file():
return sys.executable if getattr(sys, 'frozen', False) else __file__


class TraktForVLC(object):

# Check if there's a newer version of TraktForVLC on the project's github,
Expand Down Expand Up @@ -282,7 +277,7 @@ def __init__(self, datadir, configfile, daemon=False):
# Initialize Trakt client
modifiedTime = time.strftime(
'%Y-%m-%d',
time.gmtime(os.path.getmtime(__file__)))
time.gmtime(os.path.getmtime(get_file())))
self.trakt_client = TraktClient.TraktClient({
'username': trakt['Username'],
'password': trakt['Password'],
Expand Down Expand Up @@ -767,7 +762,7 @@ def daemonize(pidfile=""):
if __name__ == '__main__':
should_pair = should_daemon = False
pidfile = ""
datadir = os.path.dirname(__file__)
datadir = os.path.dirname(get_file())
logfile = ""
config = ""

Expand Down
72 changes: 62 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
version: '{branch}.{build}'
environment:
matrix:
- PYTHON: "2.6"
PYTHON_INSTALL: "2.6.6"

- PYTHON: "2.7"
PYTHON_INSTALL: "2.7.9"
PYTHON_INSTALL: "2.7.13"
should_deploy: yes

- PYTHON: "3.3"
PYTHON_INSTALL: "3.3.5"

- PYTHON: "3.4"
PYTHON_INSTALL: "3.4.3"

- PYTHON: "3.5"
PYTHON_INSTALL: "3.5.3"

- PYTHON: "3.6"
PYTHON_INSTALL: "3.6.1"

platform:
- x86
- x64
Expand Down Expand Up @@ -53,11 +57,59 @@ install:
# Install dependencies
- "pip install nose"
- if [%PYTHON%]==[2.6] pip install unittest2
- "pip install fuzzywuzzy"
- "pip install python-levenshtein"
- "pip install CacheControl six"
- "pip install pyinstaller"
- "pip install -r requirements.txt"

build_script:
# Generate exe file
- "pyinstaller --onefile TraktForVLC.py"

# Test the exe file by first looking if the --help command returns properly
- "%APPVEYOR_BUILD_FOLDER%\\dist\\TraktForVLC.exe --help"

# Then prepare for a full execution and check for the return code and output
- "MKDIR %APPVEYOR_BUILD_FOLDER%\\APPVEYOR_BUILD"
- "COPY %APPVEYOR_BUILD_FOLDER%\\config.ini.default %APPVEYOR_BUILD_FOLDER%\\APPVEYOR_BUILD\\config.ini"
- ps: $TestPid = Start-Process $env:APPVEYOR_BUILD_FOLDER\dist\TraktForVLC.exe -ArgumentList "--debug", "--datadir $env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD", "--pidfile $env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\build.pid" -RedirectStandardOutput $env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\out.log -RedirectStandardError $env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\err.log -PassThru
- ps: $timeouted = $null; $TestPid | Wait-Process -Timeout 10 -ea 0 -ev timeouted; if ($timeouted) { TASKKILL /PID $TestPid.Id /F /T; } else { echo "Exit code was $TestPid.ExitCode"; }
- ps: $path = "$env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\out.log"; if (Test-Path $path -PathType Leaf) { Get-Content $path; } else { echo "File $path does not exist"; }
- ps: $path = "$env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\err.log"; if (Test-Path $path -PathType Leaf) { Get-Content $path; } else { echo "File $path does not exist"; }
- ps: $path = "$env:APPVEYOR_BUILD_FOLDER\APPVEYOR_BUILD\logs\TraktForVLC-DEBUG.log"; if (Test-Path $path -PathType Leaf) { Get-Content $path; } else { echo "File $path does not exist"; }
- ps: if (!$timeouted) { exit(1); }

after_build:
# Put all the files that we want to export in a zip file
- "7z a -tzip %APPVEYOR_PROJECT_NAME%-%APPVEYOR_REPO_BRANCH%-%PLATFORM%.zip %APPVEYOR_BUILD_FOLDER%\\dist\\* %APPVEYOR_BUILD_FOLDER%\\config.ini.default"

# List the content of that zip file so we'll see in the log what's in there
- "7z l %APPVEYOR_PROJECT_NAME%-%APPVEYOR_REPO_BRANCH%-%PLATFORM%.zip"

artifacts:
- path: $(APPVEYOR_PROJECT_NAME)-$(APPVEYOR_REPO_BRANCH)-$(PLATFORM).zip
name: $(APPVEYOR_PROJECT_NAME)-$(APPVEYOR_REPO_BRANCH)-$(PLATFORM)

before_deploy:
- ps: if ($env:APPVEYOR_REPO_TAG -eq "true") { $env:RELEASE_NAME = $env:APPVEYOR_REPO_TAG_NAME; $env:RELEASE_DRAFT = $false; $env:RELEASE_PRE = $env:APPVEYOR_REPO_TAG_NAME -match "-a" -or $env:APPVEYOR_REPO_TAG_NAME -match "-b" -or $env:APPVEYOR_REPO_TAG_NAME -match "-rc"; if ($env:RELEASE_PRE) { $RC = $env:RELEASE_NAME -replace '^.*-(rc|a|b)',''; $RF = $env:RELEASE_NAME -replace '-(rc|a|b).*$',''; $env:RELEASE_DESCRIPTION = "This is the release candidate $RC.\nNew features will not be added to the $RF release, only bugfixes"; } else { $env:RELEASE_DESCRIPTION = "$env:RELEASE_NAME release"; } } else { $env:RELEASE_NAME = "$env:APPVEYOR_REPO_BRANCH-branch"; $env:RELEASE_PRE = $false; $env:RELEASE_DRAFT = $true; $env:RELEASE_DESCRIPTION = "Draft of release for branch $env:APPVEYOR_REPO_BRANCH"; }
- ps: 'echo "RELEASE NAME: $env:RELEASE_NAME"'
- ps: 'echo "RELEASE DESCRIPTION: $env:RELEASE_DESCRIPTION"'
- ps: 'echo "IS PRE RELEASE ? $env:RELEASE_PRE"'
- ps: 'echo "IS RELEASE DRAFT ? $env:RELEASE_DRAFT"'

build: false
deploy:
- release: $(RELEASE_NAME)
description: $(RELEASE_DESCRIPTION)
provider: GitHub
auth_token:
secure: p4SqkPeYal/Zfew4DoeZjV716Y2SlUqTpEtFCGhUkFjImW1zEuBzQ2XchsWHZLjS # your encrypted token from GitHub
artifact: $(APPVEYOR_PROJECT_NAME)-$(APPVEYOR_REPO_BRANCH)-$(PLATFORM)
draft: $(RELEASE_DRAFT)
prerelease: $(RELEASE_PRE)
on:
should_deploy: yes
appveyor_repo_tag: true # deploy on tag push only

test_script:
- "nosetests -vv -w tests/"
# Disable the tests for now, we need to fix the number of requests to imdbpie
# and the retry process before reenabling the tests
# test_script:
# - "nosetests -vv -w tests/"
test: off
1 change: 0 additions & 1 deletion imdbpie/__init__.py

This file was deleted.

68 changes: 0 additions & 68 deletions imdbpie/constants.py

This file was deleted.

1 change: 0 additions & 1 deletion imdbpie/exceptions.py

This file was deleted.

Loading

0 comments on commit bcea868

Please sign in to comment.