Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
move acre and pyblish-base to requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
antirotor committed Jan 12, 2021
1 parent bc9a7c1 commit cd15d11
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 28 deletions.
7 changes: 0 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
path = repos/avalon-core
url = [email protected]:pypeclub/avalon-core.git
branch = develop
[submodule "repos/pyblish-base"]
path = repos/pyblish-base
url = [email protected]:pyblish/pyblish-base.git
[submodule "repos/avalon-unreal-integration"]
path = repos/avalon-unreal-integration
url = [email protected]:pypeclub/avalon-unreal-integration.git
[submodule "repos/maya-look-assigner"]
path = repos/maya-look-assigner
url = [email protected]:pypeclub/maya-look-assigner.git
[submodule "repos/acre"]
path = repos/acre
url = [email protected]:antirotor/acre.git
branch = fix/unformatted-tokens
[submodule "pype/modules/ftrack/python2_vendor/ftrack-python-api"]
path = pype/modules/ftrack/python2_vendor/ftrack-python-api
url = https://bitbucket.org/ftrack/ftrack-python-api.git
Expand Down
74 changes: 58 additions & 16 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PS> .\build.ps1
#>


function Exit-WithCode($exitcode) {
# Only exit this host process if it's a child of another PowerShell parent process...
$parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId
Expand All @@ -23,6 +22,18 @@ function Exit-WithCode($exitcode) {
exit $exitcode
}

if ($PSVersionTable.PSVersion.Major -lt 7) {
Write-Host "!!! " -NoNewline -ForegroundColor Red
Write-Host "You are using old version of PowerShell. $($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)"
Write-Host "Please update to at least 7.0 - https://github.com/PowerShell/PowerShell/releases"
Exit-WithCode 1
}

$arguments=$ARGS
if($arguments -eq "--skip-venv") {
$skip_venv=$true
}

$art = @'
Expand Down Expand Up @@ -76,30 +87,61 @@ if(($matches[1] -lt 3) -or ($matches[2] -lt 7)) {
Exit-WithCode 1
}
Write-Host "OK [ $p ]" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Creating virtual env ..."
& python -m venv venv
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. (".\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1


if ($skip_venv -ne $true) {
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Creating virtual env ..."
& python -m venv venv
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. (".\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Installing packages to new venv ..."
& pip install -r .\requirements.txt
} else {
Write-Host "*** " -NoNewline -ForegroundColor yellow
Write-Host "Skipping creaton of venv ..."
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Entering venv ..."
try {
. (".\venv\Scripts\Activate.ps1")
}
catch {
Write-Host "!!! Failed to activate" -ForegroundColor red
Write-Host $_.Exception.Message
Exit-WithCode 1
}
}
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Installing packages to new venv ..."
& pip install -r .\requirements.txt

Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Cleaning cache files ... " -NoNewline
Get-ChildItem . -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
Get-ChildItem . -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
Write-Host "OK" -ForegroundColor green

# store original PYTHONPATH
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Storing original PYTHONPATH ... " -NoNewline
$original_pythonpath = $env:PYTHONPATH
Write-Host "OK" -ForegroundColor green
$new_pythonpath = Get-ChildItem -Directory -Path .\ | Microsoft.PowerShell.Utility\Join-String -Property FullName -DoubleQuote -Separator ';'
$env:PYTHONPATH = $env:PYTHONPATH + ";" + $new_pythonpath
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Adding repos to PYTHONPATH ..."

Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Building Pype ..."
& python setup.py build
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Restoring original PYTHONPATH ... " -NoNewline
$env:PYTHONPATH = $original_pythonpath
Write-Host "OK" -ForegroundColor green
deactivate
4 changes: 2 additions & 2 deletions igniter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def validate_path_string(path: str) -> (bool, str):


def add_acre_to_sys_path():
"""Add full path of acre module to sys.path on ignitation."""
"""Add full path of acre module to sys.path on ignition."""
try:
# Skip if is possible to import
import acre

except ImportError:
# Full path to acred repository related to current file
# Full path to acre repository related to current file
acre_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
"repos",
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
git+https://github.com/antirotor/acre.git@fix/unformatted-tokens
aiohttp
aiohttp_json_rpc
appdirs
Expand All @@ -18,6 +19,7 @@ log4mongo
git+https://github.com/pypeclub/OpenTimelineIO.git@develop
pathlib2
Pillow
pyblish-base
pycodestyle
pydocstyle
pylint
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@


executables = [
Executable("start.py", base=None, targetName="pype_console"),
Executable("start.py", base=base, targetName="pype")
Executable("start.py", base=None, target_name="pype_console"),
Executable("start.py", base=base, target_name="pype")
]

setup(
Expand Down
1 change: 0 additions & 1 deletion start.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def set_environments() -> None:
better handling of environments
"""
# FIXME: remove everything except global
env = load_environments(["global"])
env = acre.merge(env, dict(os.environ))
os.environ.clear()
Expand Down

0 comments on commit cd15d11

Please sign in to comment.