mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fixes issue with building windows wheels (#1098)
* Try building ABI specific wheels * Fix typo * Fix another typo * Skip cython rebuild * Try some tweaks * Revert "Skip cython rebuild" This reverts commit 3ba6002e9cc1715d9202ec778adc52e6dc7b1732. * More tweaks * Fix pathlib install * Disable 2.7 builds * Try pure python builds * Tweak and test pure builds * Tweak pure builds * Add universal wheel * Try universal wheel * Attempt to fix pyds * Try re adding platform * Keep install structure between builds * Split how we build wheels for windows * Fix broken sys argv * Fix setup platform * Adding some logging for filter * Fix platform build script * Ensure ABI tag * Fix platform abi * Test platform build of wheels * fix platform metadata * Log pyd file generation * Log dir location for pyd * recursively include *win*.pyd * limit to pydevd pyds * tweak manifest * remove unused code * restore manifest changes * fix proj path * Remove logging * Add script for linux wheels (#3) * Add linux builds * Simplify building bdist and sdist wheels. * Try with frame eval off * Ensure imports * Add instructions to build linux wheels locally.
This commit is contained in:
parent
f3289d040d
commit
4877164466
9 changed files with 140 additions and 35 deletions
|
|
@ -2,4 +2,4 @@ include LICENSE
|
|||
include DESCRIPTION.md
|
||||
global-exclude *.py[cdo]
|
||||
include versioneer.py
|
||||
include ptvsd/_version.py
|
||||
include src/ptvsd/_version.py
|
||||
|
|
|
|||
12
linux/build_plat.sh
Normal file
12
linux/build_plat.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
SOURCE_ROOT=$1
|
||||
DEST=$2
|
||||
PYABI=$3
|
||||
|
||||
# Compile
|
||||
for PYBIN in /opt/python/${PYABI}*/bin; do
|
||||
"${PYBIN}/pip" install -U cython
|
||||
"${PYBIN}/python" "${SOURCE_ROOT}/setup.py" build bdist_wheel -d "${DEST}" --abi
|
||||
done
|
||||
16
linux/readme.md
Normal file
16
linux/readme.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Building manylinux1 wheels
|
||||
|
||||
1. Clone ptvsd to base dir (say `C:\git`), so ptvsd source must be at `C:\git\ptvsd`.
|
||||
2. Create dir `dist` under `C:\git\dist`.
|
||||
3. Run following command:
|
||||
* x86_64: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_x86_64:latest /io/ptvsd/linux/build_plat.sh /io/ptvsd /io/dist cp37-cp37m`
|
||||
* i686: `docker run --rm -v C:\git:/io -w /io quay.io/pypa/manylinux1_i686:latest /io/ptvsd/linux/build_plat.sh /io/ptvsd /io/dist cp37-cp37m`
|
||||
4. After the run the built wheel should be in `C:\git\dist`.
|
||||
|
||||
Other python ABI options:
|
||||
* cp27-cp27m
|
||||
* cp27-cp27mu
|
||||
* cp34-cp34m
|
||||
* cp35-cp35m
|
||||
* cp36-cp36m
|
||||
* cp37-cp37m
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
[wheel]
|
||||
python-tag = py3
|
||||
|
||||
[metadata]
|
||||
license_file = LICENSE
|
||||
|
||||
|
|
|
|||
45
setup.py
45
setup.py
|
|
@ -9,13 +9,23 @@ import os.path
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
from setuptools import setup
|
||||
pure = None
|
||||
if '--pure' in sys.argv:
|
||||
pure = True
|
||||
sys.argv.remove('--pure')
|
||||
elif '--universal' in sys.argv:
|
||||
pure = True
|
||||
elif '--abi' in sys.argv:
|
||||
pure = False
|
||||
sys.argv.remove('--abi')
|
||||
|
||||
import versioneer
|
||||
|
||||
from setuptools import setup # noqa
|
||||
import versioneer # noqa
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src'))
|
||||
import ptvsd
|
||||
import ptvsd._vendored
|
||||
import ptvsd # noqa
|
||||
import ptvsd._vendored # noqa
|
||||
del sys.path[0]
|
||||
|
||||
|
||||
|
|
@ -23,6 +33,11 @@ PYDEVD_ROOT = ptvsd._vendored.project_root('pydevd')
|
|||
PTVSD_ROOT = os.path.dirname(os.path.abspath(ptvsd.__file__))
|
||||
|
||||
|
||||
def get_buildplatform():
|
||||
if '-p' in sys.argv:
|
||||
return sys.argv[sys.argv.index('-p') + 1]
|
||||
return None
|
||||
|
||||
def cython_build():
|
||||
print('Compiling extension modules (set SKIP_CYTHON_BUILD=1 to omit)')
|
||||
subprocess.call([
|
||||
|
|
@ -46,10 +61,29 @@ with open('DESCRIPTION.md', 'r') as fh:
|
|||
long_description = fh.read()
|
||||
|
||||
|
||||
try:
|
||||
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
|
||||
|
||||
class bdist_wheel(_bdist_wheel):
|
||||
def finalize_options(self):
|
||||
_bdist_wheel.finalize_options(self)
|
||||
self.root_is_pure = pure
|
||||
|
||||
except ImportError:
|
||||
bdist_wheel = None
|
||||
|
||||
if __name__ == '__main__':
|
||||
if not os.getenv('SKIP_CYTHON_BUILD'):
|
||||
cython_build()
|
||||
|
||||
cmds = versioneer.get_cmdclass()
|
||||
cmds['bdist_wheel'] = bdist_wheel
|
||||
|
||||
extras = {}
|
||||
platforms = get_buildplatform()
|
||||
if platforms is not None:
|
||||
extras['platforms'] = platforms
|
||||
|
||||
setup(
|
||||
name='ptvsd',
|
||||
version=versioneer.get_version(),
|
||||
|
|
@ -82,5 +116,6 @@ if __name__ == '__main__':
|
|||
'ptvsd': ['ThirdPartyNotices.txt'],
|
||||
'ptvsd._vendored': list(iter_vendored_files()),
|
||||
},
|
||||
cmdclass=versioneer.get_cmdclass(),
|
||||
cmdclass=cmds,
|
||||
**extras
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
param($packages, [switch]$pack)
|
||||
param($packages, [switch]$pack, [string]$wheeltype)
|
||||
|
||||
$root = $script:MyInvocation.MyCommand.Path | Split-Path -parent;
|
||||
if ($env:BUILD_BINARIESDIRECTORY) {
|
||||
|
|
@ -13,31 +13,30 @@ if ($env:BUILD_BINARIESDIRECTORY) {
|
|||
|
||||
$env:SKIP_CYTHON_BUILD = "1"
|
||||
|
||||
if (-not $pack) {
|
||||
(gci $packages\python* -Directory) | %{ gi $_\tools\python.exe } | ?{ Test-Path $_ } | %{
|
||||
Write-Host "Building with $_"
|
||||
& $_ -m pip install -U pyfindvs setuptools wheel cython
|
||||
pushd "$root\..\src\ptvsd\_vendored\pydevd"
|
||||
& $_ setup_cython.py enable_msbuildcompiler build_ext -b "$bin" -t "$obj"
|
||||
popd
|
||||
}
|
||||
Get-ChildItem $dist\*.whl, $dist\*.zip | Remove-Item -Force
|
||||
|
||||
} else {
|
||||
gci $dist\*.whl, $dist\*.zip | Remove-Item -Force
|
||||
(Get-ChildItem $packages\python* -Directory -Filter '*python.3.7*') | ForEach-Object{ Get-Item $_\tools\python.exe } | Where-Object{ Test-Path $_ } | Select-Object -last 1 | ForEach-Object{
|
||||
Write-Host "Building with $_"
|
||||
& $_ -m pip install -U pip
|
||||
& $_ -m pip install -U pyfindvs setuptools wheel cython
|
||||
|
||||
(gci $packages\python* -Directory) | %{ gi $_\tools\python.exe } | ?{ Test-Path $_ } | select -last 1 | %{
|
||||
if ($wheeltype -eq 'sdist') {
|
||||
Write-Host "Building sdist with $_"
|
||||
& $_ setup.py sdist -d "$dist" --formats zip
|
||||
|
||||
Write-Host "Building wheel with $_"
|
||||
& $_ setup.py build -b "$bin" -t "$obj" bdist_wheel -d "$dist"
|
||||
gci $dist\ptvsd-*.whl | %{
|
||||
Write-Host "Built wheel found at $_"
|
||||
Copy-Item $_ (Join-Path $_.Directory ($_.Name -replace '(ptvsd-.+?)-any\.whl', '$1-win_amd64.whl'))
|
||||
Copy-Item $_ (Join-Path $_.Directory ($_.Name -replace '(ptvsd-.+?)-any\.whl', '$1-win32.whl'))
|
||||
Remove-Item $_
|
||||
}
|
||||
}
|
||||
|
||||
if ($wheeltype -eq 'pure') {
|
||||
Write-Host "Building wheel with $_ pure python wheel"
|
||||
& $_ setup.py bdist_wheel -d "$dist" --pure
|
||||
}
|
||||
|
||||
if ($wheeltype -eq 'universal') {
|
||||
Write-Host "Building wheel with $_ universal wheel"
|
||||
& $_ setup.py bdist_wheel -d "$dist" --universal
|
||||
}
|
||||
|
||||
Get-ChildItem $dist\ptvsd-*.whl, $dist\*.zip | ForEach-Object{
|
||||
Write-Host "Built wheel found at $_"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
42
win/build_plat.ps1
Normal file
42
win/build_plat.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
param($packages, [switch]$pack, [string]$platform, [string]$pyver)
|
||||
|
||||
$root = $script:MyInvocation.MyCommand.Path | Split-Path -parent;
|
||||
if ($env:BUILD_BINARIESDIRECTORY) {
|
||||
$bin = mkdir -Force $env:BUILD_BINARIESDIRECTORY\bin
|
||||
$obj = mkdir -Force $env:BUILD_BINARIESDIRECTORY\obj
|
||||
$dist = mkdir -Force $env:BUILD_BINARIESDIRECTORY\dist
|
||||
} else {
|
||||
$bin = mkdir -Force $root\bin
|
||||
$obj = mkdir -Force $root\obj
|
||||
$dist = mkdir -Force $root\dist
|
||||
}
|
||||
|
||||
$env:SKIP_CYTHON_BUILD = "1"
|
||||
|
||||
$filter = "*python.$pyver*"
|
||||
if ($platform -eq 'win32'){
|
||||
$filter = "*pythonx86.$pyver*"
|
||||
}
|
||||
Write-Host "Filter: $filter"
|
||||
|
||||
if (-not $pack) {
|
||||
(Get-ChildItem $packages\python* -Directory -Filter $filter) | ForEach-Object{ Get-Item $_\tools\python.exe } | Where-Object{ Test-Path $_ } | Select-Object -last 1 | ForEach-Object{
|
||||
Write-Host "Building with $_"
|
||||
& $_ -m pip install -U pip
|
||||
& $_ -m pip install -U pyfindvs setuptools wheel cython
|
||||
|
||||
Push-Location "$root\..\src\ptvsd\_vendored\pydevd"
|
||||
& $_ setup_cython.py enable_msbuildcompiler build_ext -b "$bin" -t "$obj"
|
||||
Pop-Location
|
||||
}
|
||||
} else {
|
||||
Get-ChildItem $dist\*.whl, $dist\*.zip | Remove-Item -Force
|
||||
|
||||
(Get-ChildItem $packages\python* -Directory -Filter $filter) | ForEach-Object{ Get-Item $_\tools\python.exe } | Where-Object{ Test-Path $_ } | Select-Object -last 1 | ForEach-Object{
|
||||
Write-Host "Building wheel with $_ for platform."
|
||||
& $_ setup.py build -b "$bin" -t "$obj" bdist_wheel -d "$dist" -p "$platform" --abi
|
||||
Get-ChildItem $dist\ptvsd-*.whl | ForEach-Object{
|
||||
Write-Host "Built wheel found at $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microbuild.Core" version="0.3.0" />
|
||||
<package id="Python" version="3.6.4" />
|
||||
<package id="Pythonx86" version="3.6.4" />
|
||||
<!--package id="Python" version="3.5.4" />
|
||||
<package id="Pythonx86" version="3.5.4" /-->
|
||||
<package id="Python" version="3.7.2" />
|
||||
<package id="Pythonx86" version="3.7.2" />
|
||||
<package id="Python" version="3.6.8" />
|
||||
<package id="Pythonx86" version="3.6.8" />
|
||||
<package id="Python" version="3.5.4" />
|
||||
<package id="Pythonx86" version="3.5.4" />
|
||||
<!--<package id="Python2" version="2.7.15" />
|
||||
<package id="Python2x86" version="2.7.15" />-->
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<RootPath>$(MSBuildThisFileDirectory)\..\ptvsd\</RootPath>
|
||||
<RootPath>$(MSBuildThisFileDirectory)\..\src\ptvsd\</RootPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$(BUILD_BINARIESDIRECTORY) != ''">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue