【问题标题】:Upload using twine in appveyor using PS使用 PS 在 appveyor 中使用 twine 上传
【发布时间】:2017-06-19 13:50:43
【问题描述】:

在 AppVeyor 上的部署脚本中,我使用 ps: >- 命令根据 repo 分支进行部署:

- ps: >-
    If ($env:APPVEYOR_REPO_BRANCH -eq 'devel') { 
        echo not deploying on devel # twine upload --skip-existing -r test dist/*
    }
    ElseIf ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {  
        twine upload --skip-existing dist/*
    }
    Else {
        echo not deploying on other branches
    }

这会在 AppVeyor 构建中创建一条错误消息,如下所示:

twine : 
At line:2 char:5
+     twine upload --skip-existing dist/*
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

构建显示失败。奇怪的是,这些包被上传到 pypi 并可供下载。因此,该命令实际上执行得很好,但由于此异常,构建显示为失败。如果只有错误消息会提供更多信息...

在 AppVeyor (https://ci.appveyor.com/project/mzwiessele/gpy/build/1.0.361/job/baimi4og179tk3p8) 上使用更简单的脚本和完整输出进行另一次运行

if ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {  
    twine upload --skip-existing dist/*
} else {
    echo not deploying on other branches
}
twine : 
At line:2 char:5
+     twine upload --skip-existing dist/*
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

  0%|          | 0.00/1.21M [00:00<?, ?bytes/s]
  1%|          | 8.19K/1.21M [00:00<00:21, 56.1Kbytes/s]
  8%|8         | 98.3K/1.21M [00:00<00:14, 77.6Kbytes/s]
 33%|###3      | 401K/1.21M [00:00<00:07, 109Kbytes/s]  

  0%|          | 0.00/1.43M [00:00<?, ?bytes/s]

Uploading distributions to https://upload.pypi.org/legacy/
Uploading GPy-1.7.6-cp27-cp27m-win_amd64.whl
Uploading GPy-1.7.6.win-amd64-py2.7.exe
Command executed with exception: 

【问题讨论】:

    标签: python pypi appveyor


    【解决方案1】:

    发生这种情况是因为twine 将输出写入 StdErr,并且任何到 StdErr 的输出都被 PowerShell 主机视为RemoteException。尝试将 PS 命令重写为批处理文件。

    【讨论】:

      猜你喜欢
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-14
      • 1970-01-01
      • 2018-01-27
      • 2019-01-31
      • 1970-01-01
      相关资源
      最近更新 更多