diff --git a/data/azure-pipelines.yml b/data/azure-pipelines.yml index 6792e71627..22f85c5392 100644 --- a/data/azure-pipelines.yml +++ b/data/azure-pipelines.yml @@ -26,12 +26,31 @@ jobs: python -m pip install --upgrade pip pip install -r data/requirements.txt sudo apt-get install libhackrf-dev librtlsdr-dev xvfb - pip install pytest pytest-xvfb pytest-cov pytest-xdist - coverage --version + pip install twine setuptools wheel pytest pytest-xvfb pytest-cov pytest-xdist + python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: 'Install dependencies' - script: python setup.py build_ext --inplace displayName: "Build extensions" + + - script: python setup.py sdist + displayName: "Build sdist" + condition: eq(variables['python.version'], '3.7') + + - script: twine upload --skip-existing dist/*.gz + displayName: "Upload sdist to PyPi" + condition: and(eq(variables['python.version'], '3.7'), contains(variables['Build.SourceBranch'], 'refs/tags/')) + env: + TWINE_USERNAME: $(twine.username) + TWINE_PASSWORD: $(twine.password) + TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/" + + - task: PublishBuildArtifacts@1 + condition: eq(variables['python.version'], '3.7') + inputs: + pathtoPublish: dist/ + artifactName: 'dist' + displayName: "Publish Build Artifacts" - script: | touch tests/show_gui diff --git a/data/release.py b/data/release.py index 79d8d66be0..4c42f4914b 100644 --- a/data/release.py +++ b/data/release.py @@ -21,12 +21,6 @@ def cleanup(): def release(): - try: - import twine - except ImportError: - print("Twine is required for PyPi release!") - sys.exit(1) - script_dir = os.path.dirname(__file__) if not os.path.islink(__file__) else os.path.dirname(os.readlink(__file__)) script_dir = os.path.realpath(os.path.join(script_dir, "..")) os.chdir(script_dir) @@ -69,11 +63,6 @@ def release(): call(["git", "tag", "v" + cur_version, "-m", "version " + cur_version]) call(["git", "push", "origin", "--tags"]) # Creates tar package on https://github.com/jopohl/urh/tarball/va.b.c.d - # region Publish to PyPi - call(["python", "setup.py", "sdist"]) - call("twine upload dist/*", shell=True) - # endregion - os.remove(os.path.join(tempfile.gettempdir(), "urh_releasing")) # region Build docker image and push to DockerHub