Skip to content

Commit

Permalink
add github workflow support
Browse files Browse the repository at this point in the history
  • Loading branch information
markreidvfx committed Jun 12, 2022
1 parent 48b05a8 commit 80a4cf7
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 52 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/custom/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$ErrorActionPreference = 'Stop';


$packageName= 'vcpython27'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url = 'https://web.archive.org/web/20210106040224if_/https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi'

$packageArgs = @{
packageName = $packageName
unzipLocation = $toolsDir
fileType = 'msi'
url = $url

silentArgs = "ALLUSERS=1 /qn /norestart /l*v `"$env:TEMP\chocolatey\$($packageName)\$($packageName).MsiInstall.log`""
validExitCodes= @(0, 3010, 1641)

softwareName = 'Microsoft Visual C++ Compiler Package for Python 2.7'
checksum = '4e6342923a8153a94d44ff7307fcdd1f'
checksumType = 'md5'
}



Install-ChocolateyPackage @packageArgs
49 changes: 49 additions & 0 deletions .github/workflows/custom/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@


$ErrorActionPreference = 'Stop';

$packageName = 'vcpython27'
$softwareName = 'Microsoft Visual C++ Compiler Package for Python 2.7'
$installerType = 'MSI'

$silentArgs = '/qn /norestart'
$validExitCodes = @(0, 3010, 1605, 1614, 1641)
if ($installerType -ne 'MSI') {
$validExitCodes = @(0)
}

$uninstalled = $false
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) `
-ErrorAction SilentlyContinue `
| ? { $_.DisplayName -like "$softwareName" }

if ($key.Count -eq 1) {
$key | % {
$file = "$($_.UninstallString)"

if ($installerType -eq 'MSI') {
$silentArgs = "$($_.PSChildName) $silentArgs"

$file = ''
}

Uninstall-ChocolateyPackage -PackageName $packageName `
-FileType $installerType `
-SilentArgs "$silentArgs" `
-ValidExitCodes $validExitCodes `
-File "$file"
}
} elseif ($key.Count -eq 0) {
Write-Warning "$packageName has already been uninstalled by other means."
} elseif ($key.Count -gt 1) {
Write-Warning "$key.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:"
$key | % {Write-Warning "- $_.DisplayName"}
}


Binary file not shown.
35 changes: 35 additions & 0 deletions .github/workflows/custom/vcpython27.nuspec
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>
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>vcpython27</id>
<title>Microsoft Visual C++ Compiler for Python 2.7</title>
<version>9.0.0.30729</version>
<authors>Microsoft</authors>
<owners>fredrikaverpil</owners>
<summary>This package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.</summary>
<description>This package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.
</description>
<projectUrl>https://www.microsoft.com/en-us/download/details.aspx?id=44266</projectUrl>
<packageSourceUrl>https://www.microsoft.com/en-us/download/details.aspx?id=44266</packageSourceUrl>
<docsUrl>https://www.microsoft.com/en-us/download/details.aspx?id=44266</docsUrl>
<!--<projectSourceUrl></projectSourceUrl>-->
<!--<mailingListUrl></mailingListUrl>-->
<!--<bugTrackerUrl></bugTrackerUrl>-->
<tags>vcpython27 admin python compiler</tags>
<copyright>Microsoft</copyright>
<licenseUrl>https://www.microsoft.com/en-us/download/details.aspx?id=44266</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<!--<iconUrl>http://cdn.rawgit.com/__REPLACE_YOUR_REPO__/master/icons/vcpython27.png</iconUrl>-->
<dependencies>
<dependency id="vcredist2008" version="9.0.30729.6161" />
<dependency id="dotnet3.5" version="3.5.20140403" />
</dependencies>
<releaseNotes>https://github.com/fredrikaverpil/vcpython27/releases</releaseNotes>
<!--<provides></provides>-->
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
45 changes: 45 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python Tests

on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["2.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Setup MSVC for Python 2.7
if: ${{ runner.os == 'Windows' && matrix.python-version == '2.7' }}
run: |
choco install vcpython27 -fd --ignore-dependencies --source=".github\workflows\custom" -y
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cython
- name: Run Unit Tests
run: |
python -m unittest discover tests -v
- name: Run Cython Ext Unit Tests
run: |
python setup.py build_ext --inplace
python -m unittest discover tests -v
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

12 changes: 4 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|python-versions| |travis-build| |appveyor-build| |docs|
|python-versions| |github-build| |docs|

pyavb
=====
Expand Down Expand Up @@ -31,13 +31,9 @@ Documentation is available on `Read the Docs. <http://pyavb.readthedocs.io/>`_

.. |python-versions| image:: https://img.shields.io/badge/python-2.7%2C%203.5%2C%203.6-blue.svg

.. |travis-build| image:: https://travis-ci.org/markreidvfx/pyavb.svg?branch=master
:alt: travis build status
:target: https://travis-ci.org/markreidvfx/pyavb

.. |appveyor-build| image:: https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true
:alt: appveyor build status
:target: https://ci.appveyor.com/project/markreidvfx/pyavb
.. |github-build| image:: https://github.com/markreidvfx/pyavb/actions/workflows/python-tests.yml/badge.svg
:alt: github actions
:target: https://github.com/markreidvfx/pyavb/actions

.. |docs| image:: https://readthedocs.org/projects/pyavb/badge/?version=latest
:alt: Documentation Status
Expand Down
14 changes: 0 additions & 14 deletions appveyor.yml

This file was deleted.

13 changes: 12 additions & 1 deletion avb/_ext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

from libcpp.vector cimport vector
from libcpp.map cimport map
from libc.stdint cimport (uint8_t, int16_t, uint32_t, int32_t,uint64_t, int64_t)
from cython.operator cimport dereference as deref, preincrement as inc
cimport cython

IF UNAME_SYSNAME == "Windows":
ctypedef unsigned char uint8_t
ctypedef signed short int16_t

ctypedef signed int int32_t
ctypedef unsigned int uint32_t

ctypedef signed long long int int64_t
ctypedef unsigned long long int uint64_t
ELSE:
from libc.stdint cimport (uint8_t, int16_t, uint32_t, int32_t,uint64_t, int64_t)

from datetime import datetime
import uuid

Expand Down
9 changes: 9 additions & 0 deletions avb/_ext_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
#include <iostream>
#include <math.h>

#ifdef _MSC_VER && _MSC_VER == 1500

typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;

#endif

using namespace std;

#define TRACK_LABEL_FLAG 1 << 0
Expand Down

0 comments on commit 80a4cf7

Please sign in to comment.