From a2d7446308a5e0bfb809fd94476d139d7e4fabfb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 26 Apr 2021 09:03:45 +0300 Subject: [PATCH 01/26] Fix error inside Save layout dialog. Closes #123 --- ChangeLog.txt | 1 + src/app/valentina/dialogs/dialogsavelayout.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 51c2103b4..5588e386c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ - [smart-pattern/valentina#121] Incorrect elliptical arc end angle. - [smart-pattern/valentina#122] Extend piece bounding rect. - Remember last selected export format. +- [smart-pattern/valentina#123] Error inside Save layout dialog. # Version 0.7.46 Mar 31, 2021 - Fix incorrect calculation of value for multisize measurements in Valentina. diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index dd8dd4c54..fcc8221dd 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -548,7 +548,7 @@ void DialogSaveLayout::PathChanged(const QString &text) QDir dir(text); dir.setPath(text); - if (dir.exists(text)) + if (not text.isEmpty() && dir.exists(text)) { bOk->setEnabled(true); palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black); From 613502b392a4c58a2ddd32b4cb66539a3ea8d515 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 28 Apr 2021 20:06:24 +0300 Subject: [PATCH 02/26] Improve error handling for the dxf export. --- ChangeLog.txt | 1 + src/libs/vdxf/dxiface.cpp | 5 ++ src/libs/vdxf/dxiface.h | 2 + src/libs/vdxf/libdxfrw/libdxfrw.cpp | 98 ++++++++++++++++------------ src/libs/vdxf/libdxfrw/libdxfrw.h | 3 + src/libs/vdxf/vdxfengine.cpp | 17 +++-- src/libs/vdxf/vdxfengine.h | 2 + src/libs/vdxf/vdxfpaintdevice.cpp | 6 ++ src/libs/vdxf/vdxfpaintdevice.h | 2 + src/libs/vlayout/vlayoutexporter.cpp | 18 ++++- 10 files changed, 104 insertions(+), 50 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5588e386c..0d70c9784 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,7 @@ - [smart-pattern/valentina#122] Extend piece bounding rect. - Remember last selected export format. - [smart-pattern/valentina#123] Error inside Save layout dialog. +- Improve error handling for the dxf export. # Version 0.7.46 Mar 31, 2021 - Fix incorrect calculation of value for multisize measurements in Valentina. diff --git a/src/libs/vdxf/dxiface.cpp b/src/libs/vdxf/dxiface.cpp index 868713ab6..64b47e1c6 100644 --- a/src/libs/vdxf/dxiface.cpp +++ b/src/libs/vdxf/dxiface.cpp @@ -110,6 +110,11 @@ void dx_iface::writeEntity(DRW_Entity* e){ } } +std::string dx_iface::ErrorString() const +{ + return dxfW->ErrorString(); +} + void dx_iface::writeHeader(DRW_Header &data){ //complete copy of header vars: data = cData.headerC; diff --git a/src/libs/vdxf/dxiface.h b/src/libs/vdxf/dxiface.h index 78c9b11d2..212e5bd72 100644 --- a/src/libs/vdxf/dxiface.h +++ b/src/libs/vdxf/dxiface.h @@ -101,6 +101,8 @@ public: bool fileExport(bool binary); void writeEntity(DRW_Entity* e); + std::string ErrorString() const; + //reimplement virtual DRW_Interface functions //writer part, send all in class dx_data to writer virtual void writeHeader(DRW_Header& data) override; diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 3f74513ba..4d065baf4 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -123,55 +123,66 @@ bool dxfRW::read(DRW_Interface *interface_, bool ext){ bool dxfRW::write(DRW_Interface *interface_, DRW::Version ver, bool bin){ bool isOk = false; std::ofstream filestr; + filestr.exceptions(std::ifstream::failbit | std::ifstream::badbit); version = ver; binFile = bin; iface = interface_; - if (binFile) { - filestr.open (fileName.c_str(), std::ios_base::out | std::ios::binary | std::ios::trunc); - //write sentinel - filestr << "AutoCAD Binary DXF\r\n" << static_cast(26) << '\0'; - writer = new dxfWriterBinary(&filestr); - DRW_DBG("dxfRW::read binary file\n"); - } else { - filestr.open (fileName.c_str(), std::ios_base::out | std::ios::trunc); - writer = new dxfWriterAscii(&filestr); - std::string comm = std::string("dxfrw ") + std::string(DRW_VERSION); - writer->writeString(999, comm); - } - DRW_Header header; - iface->writeHeader(header); - writer->writeString(0, "SECTION"); - entCount =FIRSTHANDLE; - header.write(writer, version); - writer->writeString(0, "ENDSEC"); - if (ver > DRW::AC1009) { + try + { + if (binFile) { + filestr.open (fileName.c_str(), std::ios_base::out | std::ios::binary | std::ios::trunc); + //write sentinel + filestr << "AutoCAD Binary DXF\r\n" << static_cast(26) << '\0'; + writer = new dxfWriterBinary(&filestr); + DRW_DBG("dxfRW::read binary file\n"); + } else { + filestr.open (fileName.c_str(), std::ios_base::out | std::ios::trunc); + writer = new dxfWriterAscii(&filestr); + std::string comm = std::string("dxfrw ") + std::string(DRW_VERSION); + writer->writeString(999, comm); + } + DRW_Header header; + iface->writeHeader(header); writer->writeString(0, "SECTION"); - writer->writeString(2, "CLASSES"); + entCount =FIRSTHANDLE; + header.write(writer, version); writer->writeString(0, "ENDSEC"); - } - writer->writeString(0, "SECTION"); - writer->writeString(2, "TABLES"); - writeTables(); - writer->writeString(0, "ENDSEC"); - writer->writeString(0, "SECTION"); - writer->writeString(2, "BLOCKS"); - writeBlocks(); - writer->writeString(0, "ENDSEC"); - - writer->writeString(0, "SECTION"); - writer->writeString(2, "ENTITIES"); - iface->writeEntities(); - writer->writeString(0, "ENDSEC"); - - if (version > DRW::AC1009) { + if (ver > DRW::AC1009) { + writer->writeString(0, "SECTION"); + writer->writeString(2, "CLASSES"); + writer->writeString(0, "ENDSEC"); + } writer->writeString(0, "SECTION"); - writer->writeString(2, "OBJECTS"); - writeObjects(); + writer->writeString(2, "TABLES"); + writeTables(); writer->writeString(0, "ENDSEC"); + writer->writeString(0, "SECTION"); + writer->writeString(2, "BLOCKS"); + writeBlocks(); + writer->writeString(0, "ENDSEC"); + + writer->writeString(0, "SECTION"); + writer->writeString(2, "ENTITIES"); + iface->writeEntities(); + writer->writeString(0, "ENDSEC"); + + if (version > DRW::AC1009) { + writer->writeString(0, "SECTION"); + writer->writeString(2, "OBJECTS"); + writeObjects(); + writer->writeString(0, "ENDSEC"); + } + writer->writeString(0, "EOF"); + filestr.flush(); + filestr.close(); + } + catch(std::ofstream::failure &writeErr) + { + errorString = writeErr.what(); + delete writer; + writer = nullptr; + return isOk; } - writer->writeString(0, "EOF"); - filestr.flush(); - filestr.close(); isOk = true; delete writer; writer = nullptr; @@ -1160,6 +1171,11 @@ bool dxfRW::writeDimension(DRW_Dimension *ent) { return true; } +std::string dxfRW::ErrorString() const +{ + return errorString; +} + bool dxfRW::writeInsert(DRW_Insert *ent){ writer->writeString(0, "INSERT"); writeEntity(ent); diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.h b/src/libs/vdxf/libdxfrw/libdxfrw.h index fa20baced..c866b0a6a 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.h +++ b/src/libs/vdxf/libdxfrw/libdxfrw.h @@ -72,6 +72,8 @@ public: bool writeDimension(DRW_Dimension *ent); void setEllipseParts(int parts){elParts = parts;} /*!< set parts munber when convert ellipse to polyline */ + std::string ErrorString() const; + private: Q_DISABLE_COPY(dxfRW) /// used by read() to parse the content of the file @@ -144,6 +146,7 @@ private: int currHandle; + std::string errorString{}; }; #endif // LIBDXFRW_H diff --git a/src/libs/vdxf/vdxfengine.cpp b/src/libs/vdxf/vdxfengine.cpp index 7badba13a..ad8887f86 100644 --- a/src/libs/vdxf/vdxfengine.cpp +++ b/src/libs/vdxf/vdxfengine.cpp @@ -138,8 +138,7 @@ bool VDxfEngine::begin(QPaintDevice *pdev) //--------------------------------------------------------------------------------------------------------------------- bool VDxfEngine::end() { - const bool res = input->fileExport(m_binary); - return res; + return input->fileExport(m_binary); } //--------------------------------------------------------------------------------------------------------------------- @@ -611,6 +610,12 @@ void VDxfEngine::SetYScale(const qreal &yscale) m_yscale = yscale; } +//--------------------------------------------------------------------------------------------------------------------- +QString VDxfEngine::ErrorString() const +{ + return QString::fromStdString(input->ErrorString()); +} + //--------------------------------------------------------------------------------------------------------------------- QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wswitch-default") @@ -668,7 +673,7 @@ bool VDxfEngine::ExportToAAMA(const QVector &details) for(auto detail : details) { - dx_ifaceBlock *detailBlock = new dx_ifaceBlock(); + auto *detailBlock = new dx_ifaceBlock(); QString blockName = detail.GetName(); if (m_version <= DRW::AC1009) @@ -691,7 +696,7 @@ bool VDxfEngine::ExportToAAMA(const QVector &details) input->AddBlock(detailBlock); - DRW_Insert *insert = new DRW_Insert(); + auto *insert = new DRW_Insert(); insert->name = blockName.toStdString(); insert->layer = '1'; @@ -869,7 +874,7 @@ bool VDxfEngine::ExportToASTM(const QVector &details) for(auto detail : details) { - dx_ifaceBlock *detailBlock = new dx_ifaceBlock(); + auto *detailBlock = new dx_ifaceBlock(); QString blockName = detail.GetName(); if (m_version <= DRW::AC1009) @@ -894,7 +899,7 @@ bool VDxfEngine::ExportToASTM(const QVector &details) input->AddBlock(detailBlock); - DRW_Insert *insert = new DRW_Insert(); + auto *insert = new DRW_Insert(); insert->name = blockName.toStdString(); insert->layer = '1'; diff --git a/src/libs/vdxf/vdxfengine.h b/src/libs/vdxf/vdxfengine.h index 9a95b63b7..623698e8c 100644 --- a/src/libs/vdxf/vdxfengine.h +++ b/src/libs/vdxf/vdxfengine.h @@ -98,6 +98,8 @@ public: qreal GetYScale() const; void SetYScale(const qreal &yscale); + QString ErrorString() const; + private: Q_DISABLE_COPY(VDxfEngine) QSize size; diff --git a/src/libs/vdxf/vdxfpaintdevice.cpp b/src/libs/vdxf/vdxfpaintdevice.cpp index 23622d211..495d75f83 100644 --- a/src/libs/vdxf/vdxfpaintdevice.cpp +++ b/src/libs/vdxf/vdxfpaintdevice.cpp @@ -214,6 +214,12 @@ bool VDxfPaintDevice::ExportToASTM(const QVector &details) const return res; } +//--------------------------------------------------------------------------------------------------------------------- +QString VDxfPaintDevice::ErrorString() const +{ + return engine->ErrorString(); +} + //--------------------------------------------------------------------------------------------------------------------- int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const { diff --git a/src/libs/vdxf/vdxfpaintdevice.h b/src/libs/vdxf/vdxfpaintdevice.h index a78f762f8..a03e6df9f 100644 --- a/src/libs/vdxf/vdxfpaintdevice.h +++ b/src/libs/vdxf/vdxfpaintdevice.h @@ -75,6 +75,8 @@ public: bool ExportToAAMA(const QVector &details) const; bool ExportToASTM(const QVector &details) const; + QString ErrorString() const; + protected: virtual int metric(PaintDeviceMetric metric) const override; private: diff --git a/src/libs/vlayout/vlayoutexporter.cpp b/src/libs/vlayout/vlayoutexporter.cpp index 9ffceca45..42c168cd5 100644 --- a/src/libs/vlayout/vlayoutexporter.cpp +++ b/src/libs/vlayout/vlayoutexporter.cpp @@ -301,7 +301,11 @@ void VLayoutExporter::ExportToFlatDXF(QGraphicsScene *scene, const QListrender(&painter, m_imageRect, m_imageRect, Qt::IgnoreAspectRatio); - painter.end(); + if (not painter.end()) + { + qCritical() << tr("Can't create an flat dxf file.") + << generator.ErrorString(); + } } RestoreTextAfterDXF(endStringPlaceholder, details); @@ -319,7 +323,11 @@ void VLayoutExporter::ExportToAAMADXF(const QVector &details) cons generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745 generator.SetXScale(m_xScale); generator.SetYScale(m_yScale); - generator.ExportToAAMA(details); + if (not generator.ExportToAAMA(details)) + { + qCritical() << tr("Can't create an AAMA dxf file.") + << generator.ErrorString(); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -334,7 +342,11 @@ void VLayoutExporter::ExportToASTMDXF(const QVector &details) cons generator.setInsunits(VarInsunits::Millimeters);// Decided to always use mm. See issue #745 generator.SetXScale(m_xScale); generator.SetYScale(m_yScale); - generator.ExportToASTM(details); + if (not generator.ExportToASTM(details)) + { + qCritical() << tr("Can't create an ASTM dxf file.") + << generator.ErrorString(); + } } //--------------------------------------------------------------------------------------------------------------------- From 9b268395f26ba02f0cb73fe93f56e54a03beb53e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 1 May 2021 19:54:48 +0300 Subject: [PATCH 03/26] Bintray is no longer available for us. --- .travis.yml | 42 +++++++-------- appveyor.yml | 29 +++++------ scripts/deploy.py | 129 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+), 39 deletions(-) create mode 100644 scripts/deploy.py diff --git a/.travis.yml b/.travis.yml index dda0880d7..e005f8fcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: cpp +env: + global: + - secure: Zo+BbyV3sgNmKHwWvn7cCt3leXCLGbE9rSrAYoCrl22OEDZjPj7KeGzQ/59xLosE5v8PA5MV8KceH7aQB9GoIbDt6sHLw5mws13VXmy5HWtM7yhk2RpNnn1gTZIfEz33QGYuPG1geapTcZtZfaVKFU04PMkvk3f7zxA1HuS6zGRgzrNv1AmcpuOGH4LIGxbk3Z1S6xGcUMj/z9calyLlmPTOfbDLJWChU11FMVmvdTzyeDLE0oQZ5IkmsowluCfDHARfIijeRuPiuU8RzJptYEIzcWvpQ6gfDb4qDWndA9BgPDkN2aTmPL5/TA/S9zfs8BKjo07sg0TaVbTboPisyS/gGDf3SBYxlAS9B95KKdRzGGD41ZYe+cHod5tgWUt5gO/Obq2MPY/GltSwuq5KEsR+R/pKVLby/k7+R5oCO8avXJPL5HBgn46ZehEzpw0I8LFQ/ed+dLqykrxaSiA2/zHAkHSeVZptzegoCF5xeDf6T/rJFNqxr1BV3kVLPiXW90z0m63Hv2K6rz8LmBUNTQcR/mrLpkpdbQ8UQ/et30o7CE2GcJLLzUDNcjxYfA1fe66oR9L+euqyBtZc8dNuzy1iIaUOLazGWYkdlUpiYnGvWrxv6BUwzAJYpiXjWELtcTVUGMjMBpkvAmwV1FjZN45isX2iHGz5XhoVDrjbE5c= jobs: include: - stage: main test @@ -9,10 +12,10 @@ jobs: - DEPLOY=false - CCACHE_CPP2=yes - RUN_TESTS=true - cache: - ccache: true - directories: - - "$HOME/.sonar/cache" + cache: + ccache: true + directories: + - "$HOME/.sonar/cache" - os: linux dist: bionic compiler: clang @@ -21,9 +24,9 @@ jobs: - CCACHE_CPP2=yes - RUN_TESTS=true cache: - ccache: true - directories: - - "$HOME/.sonar/cache" + ccache: true + directories: + - "$HOME/.sonar/cache" - os: osx compiler: clang env: @@ -32,8 +35,8 @@ jobs: osx_image: xcode11 cache: directories: - - $HOME/Library/Caches/Homebrew - - /usr/local/Homebrew + - "$HOME/Library/Caches/Homebrew" + - "/usr/local/Homebrew" - os: osx compiler: clang env: @@ -42,8 +45,8 @@ jobs: osx_image: xcode8 cache: directories: - - $HOME/Library/Caches/Homebrew - - /usr/local/Homebrew + - "$HOME/Library/Caches/Homebrew" + - "/usr/local/Homebrew" before_cache: - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi # Credit https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/9 @@ -80,6 +83,9 @@ before_install: brew link qt --force; chmod -R 755 /usr/local/opt/qt/* fi + brew install python3; + python3 --version; + pip install dropbox; fi before_script: - | @@ -129,23 +135,15 @@ notifications: - dismine@gmail.com on_success: change on_failure: always -before_deploy: +after_success: - | if [[ "$DEPLOY" == "true" ]]; then ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; if [[ "$LEGACY" = false ]]; then tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}.tar.gz Valentina.app/; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/valentina-osx-${TRAVIS_COMMIT}.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; else tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz Valentina.app/; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; fi fi -deploy: - provider: bintray - skip_cleanup: true - file: "../share/bintray.json" - user: dismine - key: - secure: q9rcswyUyOqHAnxL0FLEQ8tdFkE21kNlv/TUpZgk0MbcsWRhBWaKJVv5kz6ABkjeLMB7c7eS7KfYRui0RFBKHI7ZnpzHBZN4f1aGd/rf9m5qaZdKFFBlpz4tXPHvXOVyXRwOReqFj7brAz6NB+oqJN8HFA4Q1y039yZOaHt28JkwYSDqS5lRvbwegYS8kaJupGZcm8NaNeB8tuXuZ/8DIQpZdVKmBUwpgpPAewCEqYP4z9DUpsmMZ5h63g7mJKm9di91cQr65eS24io6m1ZfAx8M6kTaKwyR5nz8a8bnqR48AAnbNoM8Xj1sgJqnT40DZKPCNr7KL3JSNRglKNgHVMFBOj0v9F5YxsDs8twWuqFVbywB+lNSHDyvGVgmS2+EdwKLQT0YBxYfIL1nh34ed7GffZZmBcAJGfxo8ieAMRgyylSyQIHJ0ZBl6X6DzOvLpvFlcva9yhqZfkx3P/Dgarqklnj3DdvzTDW2vxCT4yVLpMySlBXW2I3s7m8xpOjZbM7eZfMZkwjd/e8IYp8jxdQnxlzNe15mzxSXnZjLz3Rwi1qzhJZyZf4OGVxuQuR9oW+c5q55OOY5hImtZELlJyu1K0zKTd85g0D+WwKj4J30J0QWl1pxZlln59Q5cMmpyQ7sc8zN1WPoWAEyavwPrf4028TpEJqaUw/0cQGg9I4= - on: - all_branches: true - condition: "$DEPLOY = true" diff --git a/appveyor.yml b/appveyor.yml index ca4c6877a..01e4340a4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,12 +37,15 @@ clone_depth: 1 # clone entire repository history if not de shallow_clone: false # default is "false" environment: + ACCESS_TOKEN: + secure: RUhnEHqaR8KhalOMWwZZOoO342Ja50QV4KpEWdm9g3pG+jG7i6aJqUmeKF1l5VN6dzksk1u+yN6pOLnU8oGcaVQ6v+1dpKK1oZvF0tyHhNE= matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.15\mingw81_32 QT_VERSION: Qt5.15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_32\bin + PYTHON: "C:\\Python38" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -50,6 +53,7 @@ environment: QT_VERSION: Qt5.6 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw492_32\bin + PYTHON: "C:\\Python38" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -191,6 +195,8 @@ init: - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%QMAKE_GENERATOR%"=="NMake Makefiles JOM" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH% - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% + - if "%DEPLOY%" == "true" "%PYTHON%\\python -m pip install dropbox" + - if "%DEPLOY%" == "true" set PATH="%PYTHON%\\Scripts\\;%PATH%" - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after - path @@ -244,21 +250,10 @@ notifications: after_test: - if "%DEPLOY%" == "true" (mingw32-make install) -artifacts: - - path: build/package/valentina - name: valentina-win-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT) +# scripts to run before deployment +before_deploy: + - if "%DEPLOY%" == "true" (%PYTHON%\\python ..\scripts\deploy.py pack ./package/valentina/ ./package/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) -deploy: -- provider: BinTray - username: dismine - api_key: - secure: dlVBgPG66AfYTbgi9EQFaK4lZeF77H6/aiuKlmCWP02/i85HLtCMnlOkyWJR5XCu - subject: dismine - repo: Valentina - package: valentina-win_auto-upload - publish: true - override: true - version: 0.7.46 - on: - DEPLOY: true - artifact: valentina-win-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT) +# to run your custom scripts instead of provider deployments +deploy_script: + - if "%DEPLOY%" == "true" (%PYTHON%\\python ..\scripts\deploy.py upload $(ACCESS_TOKEN) ./package/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) diff --git a/scripts/deploy.py b/scripts/deploy.py new file mode 100644 index 000000000..a66fae704 --- /dev/null +++ b/scripts/deploy.py @@ -0,0 +1,129 @@ +import argparse +import os +import pathlib +import shutil +import sys + +import dropbox +from dropbox import DropboxOAuth2FlowNoRedirect +from dropbox.exceptions import ApiError, AuthError +from dropbox.files import WriteMode + +APP_KEY = "v33m5tjz020h7uy" + + +def run_auth(): + """ + Use to generate a refresh token + """ + auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, use_pkce=True, token_access_type='offline') + + authorize_url = auth_flow.start() + print("1. Go to: " + authorize_url) + print("2. Click \"Allow\" (you might have to log in first).") + print("3. Copy the authorization code.") + auth_code = input("Enter the authorization code here: ").strip() + + try: + oauth_result = auth_flow.finish(auth_code) + except Exception as e: + print('Error: %s' % (e,)) + exit(1) + + print("Refresh token: %s" % oauth_result.refresh_token) + + +def run_pack(source, destination): + """ + Pack folder. Automatically fills arguments for shutil.make_archive. + :param source: path to source root directory. Example: '/path/to/folder/' + :param destination: path to resulting zip archive. The path must include a format suffix. + Example: '/path/to/folder.zip' + """ + base = os.path.basename(destination) + name = base.split('.')[0] + + formats = { + ".zip": "zip", + ".tar.xz": "xztar" + } + suffix = ''.join(pathlib.Path(base).suffixes) + format = formats.get(suffix, None) + archive_from = pathlib.Path(source).parent + archive_to = os.path.basename(source.strip(os.sep)) + print(source, destination, archive_from) + shutil.make_archive(name, format, archive_from, archive_to) + shutil.move('%s%s' % (name, suffix), destination) + + +def run_upload(refresh_token, file, path): + with dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=APP_KEY) as dbx: + # Check that the access token is valid + try: + dbx.users_get_current_account() + except AuthError: + sys.exit("ERROR: Invalid access token; try re-generating an " + "access token from the app console on the web.") + + print("Uploading " + file + " to Dropbox as " + path + "...") + try: + with open(file, "rb") as f: + dbx.files_upload(f.read(), path, mode=WriteMode('overwrite')) + except ApiError as err: + # This checks for the specific error where a user doesn't have + # enough Dropbox space quota to upload this file + if (err.error.is_path() and + err.error.get_path().reason.is_insufficient_space()): + sys.exit("ERROR: Cannot deploy; insufficient space.") + elif err.user_message_text: + print(err.user_message_text) + sys.exit() + else: + print(err) + sys.exit() + print("Successfully uploaded") + + +def parse_args(args=None): + parser = argparse.ArgumentParser(prog='app') + cmds = parser.add_subparsers(help='commands') + + def cmd(name, **kw): + p = cmds.add_parser(name, **kw) + p.set_defaults(cmd=name) + p.arg = lambda *a, **kw: p.add_argument(*a, **kw) and p + p.exe = lambda f: p.set_defaults(exe=f) and p + + # global options + # p.arg('-s', '--settings', help='application settings') + return p + + cmd('auth', help='Authorize application') \ + .exe(lambda _: ( + run_auth() + )) + + cmd('pack', help='Compress folder') \ + .arg('source', type=str, help='Path to folder or file') \ + .arg('destination', type=str, help='Path to resulting zip archive') \ + .exe(lambda a: ( + run_pack(a.source, a.destination) + )) + + cmd('upload', help='Upload file with override') \ + .arg('refresh_token', type=str, help='Refresh token') \ + .arg('file', type=str, help='Path to file') \ + .arg('path', type=str, help='Path on disk') \ + .exe(lambda a: ( + run_upload(a.refresh_token, a.file, a.path) + )) + + args = parser.parse_args(args) + if not hasattr(args, 'exe'): + parser.print_usage() + else: + args.exe(args) + + +if __name__ == '__main__': + parse_args() From 0479b897c5ed4de588c317c8de5e138acaf901f4 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 16:24:59 +0300 Subject: [PATCH 04/26] Fixing issues. --- .travis.yml | 2 +- appveyor.yml | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e005f8fcb..f4bdc7f67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_install: fi brew install python3; python3 --version; - pip install dropbox; + pip3 install dropbox; fi before_script: - | diff --git a/appveyor.yml b/appveyor.yml index 01e4340a4..69a1c97c7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -195,8 +195,13 @@ init: - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%QMAKE_GENERATOR%"=="NMake Makefiles JOM" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH% - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% - - if "%DEPLOY%" == "true" "%PYTHON%\\python -m pip install dropbox" - - if "%DEPLOY%" == "true" set PATH="%PYTHON%\\Scripts\\;%PATH%" + - if "%DEPLOY%" == "true" set PATH="%PYTHON%;%PYTHON%\\Scripts\\;%PATH%" + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + # Install the build dependencies of the project. + - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe -m pip install dropbox" + # Set paths to libraries - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after - path @@ -252,8 +257,9 @@ after_test: # scripts to run before deployment before_deploy: - - if "%DEPLOY%" == "true" (%PYTHON%\\python ..\scripts\deploy.py pack ./package/valentina/ ./package/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (%PYTHON%\\python.exe ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (%PYTHON%\\python ..\scripts\deploy.py upload $(ACCESS_TOKEN) ./package/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (%PYTHON%\\python.exe ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + From 6a5e29bebaf3978175b7cd40823c2a3abedbeb4f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 16:43:12 +0300 Subject: [PATCH 05/26] Fix issues. --- .travis.yml | 1 - appveyor.yml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4bdc7f67..f62b08c87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,7 +83,6 @@ before_install: brew link qt --force; chmod -R 755 /usr/local/opt/qt/* fi - brew install python3; python3 --version; pip3 install dropbox; fi diff --git a/appveyor.yml b/appveyor.yml index 69a1c97c7..b5f329c25 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -197,8 +197,8 @@ init: - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% - if "%DEPLOY%" == "true" set PATH="%PYTHON%;%PYTHON%\\Scripts\\;%PATH%" # Check that we have the expected version and architecture for Python - - "python --version" - - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe --version" + - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\"" # Install the build dependencies of the project. - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe -m pip install dropbox" # Set paths to libraries From 586d81f522b349170b86c22399553a1b9a2d33e9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 17:26:52 +0300 Subject: [PATCH 06/26] Fix issues. --- .travis.yml | 7 ++++--- appveyor.yml | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index f62b08c87..adf9d2fbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,7 +81,8 @@ before_install: unset SSL_CERT_FILE; HOMEBREW_NO_AUTO_UPDATE=1 brew install https://gist.githubusercontent.com/dismine/c3ac01de38e12edcf22d9e05791adf82/raw/f553c39bbc5f3a2b231a767924e846bdd2a56d8d/qt.rb; brew link qt --force; - chmod -R 755 /usr/local/opt/qt/* + chmod -R 755 /usr/local/opt/qt/*; + HOMEBREW_NO_AUTO_UPDATE=1 brew install python3; fi python3 --version; pip3 install dropbox; @@ -140,9 +141,9 @@ after_success: ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; if [[ "$LEGACY" = false ]]; then tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/valentina-osx-${TRAVIS_COMMIT}.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; else tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; fi fi diff --git a/appveyor.yml b/appveyor.yml index b5f329c25..0fe950b0a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -195,12 +195,12 @@ init: - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%QMAKE_GENERATOR%"=="NMake Makefiles JOM" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH% - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% - - if "%DEPLOY%" == "true" set PATH="%PYTHON%;%PYTHON%\\Scripts\\;%PATH%" + - if "%DEPLOY%" == "true" set PATH="%PYTHON%;%PYTHON%\Scripts;%PATH%" # Check that we have the expected version and architecture for Python - - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe --version" - - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\"" + - if "%DEPLOY%" == "true" "%PYTHON%\python.exe --version" + - if "%DEPLOY%" == "true" "%PYTHON%\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\"" # Install the build dependencies of the project. - - if "%DEPLOY%" == "true" "%PYTHON%\\python.exe -m pip install dropbox" + - if "%DEPLOY%" == "true" "%PYTHON%\python.exe -m pip install dropbox" # Set paths to libraries - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after @@ -257,9 +257,9 @@ after_test: # scripts to run before deployment before_deploy: - - if "%DEPLOY%" == "true" (%PYTHON%\\python.exe ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (%PYTHON%\python.exe ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (%PYTHON%\\python.exe ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (%PYTHON%\python.exe ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) From 49ef6ae27939e10ee747ebdb6f487bd1795d7ff8 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 18:27:22 +0300 Subject: [PATCH 07/26] Fix deploy issues. --- .travis.yml | 6 +++--- appveyor.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index adf9d2fbc..a1d1b2436 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ before_install: chmod -R 755 /usr/local/opt/qt5/* else unset SSL_CERT_FILE; - HOMEBREW_NO_AUTO_UPDATE=1 brew install https://gist.githubusercontent.com/dismine/c3ac01de38e12edcf22d9e05791adf82/raw/f553c39bbc5f3a2b231a767924e846bdd2a56d8d/qt.rb; + HOMEBREW_NO_AUTO_UPDATE=1 brew install https://gist.githubusercontent.com/dismine/c3ac01de38e12edcf22d9e05791adf82/raw/7cc6650d879a5cc435edf6157b97420893718112/qt.rb; brew link qt --force; chmod -R 755 /usr/local/opt/qt/*; HOMEBREW_NO_AUTO_UPDATE=1 brew install python3; @@ -141,9 +141,9 @@ after_success: ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; if [[ "$LEGACY" = false ]]; then tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; else tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; fi fi diff --git a/appveyor.yml b/appveyor.yml index 0fe950b0a..eff4cd70d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,7 +45,7 @@ environment: QT_VERSION: Qt5.15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_32\bin - PYTHON: "C:\\Python38" + PYTHON: "C:\Python38" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -53,7 +53,7 @@ environment: QT_VERSION: Qt5.6 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw492_32\bin - PYTHON: "C:\\Python38" + PYTHON: "C:\Python38" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 From ff6887dec4372f6ffcd4852165fad7f122bdc62d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 18:33:26 +0300 Subject: [PATCH 08/26] Fix deploy issues. --- .travis.yml | 2 +- appveyor.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1d1b2436..e8e41eed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ before_install: chmod -R 755 /usr/local/opt/qt5/* else unset SSL_CERT_FILE; - HOMEBREW_NO_AUTO_UPDATE=1 brew install https://gist.githubusercontent.com/dismine/c3ac01de38e12edcf22d9e05791adf82/raw/7cc6650d879a5cc435edf6157b97420893718112/qt.rb; + HOMEBREW_NO_AUTO_UPDATE=1 brew install https://gist.githubusercontent.com/dismine/c3ac01de38e12edcf22d9e05791adf82/raw/1218041ffba3ff4b64d109e64a9a867f8fe394c1/qt.rb; brew link qt --force; chmod -R 755 /usr/local/opt/qt/*; HOMEBREW_NO_AUTO_UPDATE=1 brew install python3; diff --git a/appveyor.yml b/appveyor.yml index eff4cd70d..ff31219b8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,7 +45,7 @@ environment: QT_VERSION: Qt5.15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_32\bin - PYTHON: "C:\Python38" + PYTHON: "C:\Python38-x64" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -53,7 +53,7 @@ environment: QT_VERSION: Qt5.6 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw492_32\bin - PYTHON: "C:\Python38" + PYTHON: "C:\Python38-x64" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 From d998a0e14582f7d7394fe497644fba6bd7bf46aa Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 19:55:46 +0300 Subject: [PATCH 09/26] Another try to make it work. --- appveyor.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ff31219b8..18c431ae8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -195,16 +195,17 @@ init: - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%QMAKE_GENERATOR%"=="NMake Makefiles JOM" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH% - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% - - if "%DEPLOY%" == "true" set PATH="%PYTHON%;%PYTHON%\Scripts;%PATH%" - # Check that we have the expected version and architecture for Python - - if "%DEPLOY%" == "true" "%PYTHON%\python.exe --version" - - if "%DEPLOY%" == "true" "%PYTHON%\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\"" - # Install the build dependencies of the project. - - if "%DEPLOY%" == "true" "%PYTHON%\python.exe -m pip install dropbox" + - if "%DEPLOY%" == "true" "SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%" # Set paths to libraries - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after - path + # Check that we have the expected version and architecture for Python + - if "%DEPLOY%" == "true" "python --version" + - if "%DEPLOY%" == "true" "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + # Install the build dependencies of the project. + - if "%DEPLOY%" == "true" "python -m pip install --upgrade pip" + - if "%DEPLOY%" == "true" "python -m pip install dropbox" # Trick qmake to not work through MSYS - del /F "C:\Program Files\Git\usr\bin\sh.exe" - del /F "C:\Program Files\Git\bin\sh.exe" @@ -257,9 +258,9 @@ after_test: # scripts to run before deployment before_deploy: - - if "%DEPLOY%" == "true" (%PYTHON%\python.exe ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" "python ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (%PYTHON%\python.exe ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" "python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" From 666633a1ff4d74bb6ee1012e63dd6deb90bcf820 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 19:58:24 +0300 Subject: [PATCH 10/26] Another try. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 18c431ae8..20f59635a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,7 +45,7 @@ environment: QT_VERSION: Qt5.15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_32\bin - PYTHON: "C:\Python38-x64" + PYTHON: "C:\\Python38-x64" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -53,7 +53,7 @@ environment: QT_VERSION: Qt5.6 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw492_32\bin - PYTHON: "C:\Python38-x64" + PYTHON: "C:\\Python38-x64" PLATFORM: x86 DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 From c23f8fbd70c31ec45b201774dd747e3c99ad0484 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 20:01:20 +0300 Subject: [PATCH 11/26] Another try. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 20f59635a..1bbf8a5f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -195,7 +195,7 @@ init: - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%QMAKE_GENERATOR%"=="NMake Makefiles JOM" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - if "%QMAKE_GENERATOR%" == "MinGW Makefiles" set PATH=%MINGW_PATH%;%PATH% - if "%QMAKE_GENERATOR%" == "NMake Makefiles JOM" set PATH=C:\Qt\Tools\QtCreator\bin;%PATH% - - if "%DEPLOY%" == "true" "SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%" + - if "%DEPLOY%" == "true" set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% # Set paths to libraries - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after From d8043c03b3e14fff32f36a3bf3429dd648624b1a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 20:02:35 +0300 Subject: [PATCH 12/26] Another try. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1bbf8a5f5..b91407d88 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -201,7 +201,7 @@ init: # Path after - path # Check that we have the expected version and architecture for Python - - if "%DEPLOY%" == "true" "python --version" + - if "%DEPLOY%" == "true" (python --version) - if "%DEPLOY%" == "true" "python -c \"import struct; print(struct.calcsize('P') * 8)\"" # Install the build dependencies of the project. - if "%DEPLOY%" == "true" "python -m pip install --upgrade pip" From eb0dfb1f7a8557c5bf8c8e476ab37f865cf6c259 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 20:04:15 +0300 Subject: [PATCH 13/26] This time should work. --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b91407d88..7e7455b22 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -202,10 +202,10 @@ init: - path # Check that we have the expected version and architecture for Python - if "%DEPLOY%" == "true" (python --version) - - if "%DEPLOY%" == "true" "python -c \"import struct; print(struct.calcsize('P') * 8)\"" + - if "%DEPLOY%" == "true" (python -c \"import struct; print(struct.calcsize('P') * 8)\") # Install the build dependencies of the project. - - if "%DEPLOY%" == "true" "python -m pip install --upgrade pip" - - if "%DEPLOY%" == "true" "python -m pip install dropbox" + - if "%DEPLOY%" == "true" (python -m pip install --upgrade pip) + - if "%DEPLOY%" == "true" (python -m pip install dropbox) # Trick qmake to not work through MSYS - del /F "C:\Program Files\Git\usr\bin\sh.exe" - del /F "C:\Program Files\Git\bin\sh.exe" @@ -258,9 +258,9 @@ after_test: # scripts to run before deployment before_deploy: - - if "%DEPLOY%" == "true" "python ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" + - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" "python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" + - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) From 7eea280f83c2a377d119c7359ed6fbaa15147fa2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 2 May 2021 20:05:34 +0300 Subject: [PATCH 14/26] Remove optional check. --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7e7455b22..cae083396 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -200,9 +200,8 @@ init: - set PATH=C:\projects\valentina\build\src\libs\vpropertyexplorer\bin;C:\projects\valentina\build\src\libs\qmuparser\bin;%PATH% # Path after - path - # Check that we have the expected version and architecture for Python + # Check that we have the expected version for Python - if "%DEPLOY%" == "true" (python --version) - - if "%DEPLOY%" == "true" (python -c \"import struct; print(struct.calcsize('P') * 8)\") # Install the build dependencies of the project. - if "%DEPLOY%" == "true" (python -m pip install --upgrade pip) - if "%DEPLOY%" == "true" (python -m pip install dropbox) From 112854187a5ee7071ec87093408c132b208d4233 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 11:34:39 +0300 Subject: [PATCH 15/26] Fix deploy issue. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cae083396..375c76d87 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -257,9 +257,9 @@ after_test: # scripts to run before deployment before_deploy: - - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py pack .\package\valentina\ .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py pack .\package\valentina\ ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload "$(ACCESS_TOKEN)" ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") From 0418b546bb8308e9f28a9655930c37c06281e24c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 12:11:55 +0300 Subject: [PATCH 16/26] Fix deploy issue. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 375c76d87..58d707962 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -261,5 +261,5 @@ before_deploy: # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload "$(ACCESS_TOKEN)" ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") + - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") From db1efb4bb43c2943e67289340d9f4983da46ffdb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 13:22:20 +0300 Subject: [PATCH 17/26] Fix deploy issue. --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 58d707962..b007eeb38 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -261,5 +261,6 @@ before_deploy: # to run your custom scripts instead of provider deployments deploy_script: - - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") + - | + if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) From df6cceb620ecc5fa330b48292c166c459b72b978 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 14:13:05 +0300 Subject: [PATCH 18/26] Fix deploy issue. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b007eeb38..e1734a9bb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -261,6 +261,6 @@ before_deploy: # to run your custom scripts instead of provider deployments deploy_script: - - | - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload $(ACCESS_TOKEN) .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - >- + if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload %ACCESS_TOKEN% .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) From a4ea99078d4b4e05ca9d4fa45b09662e9d6035a0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 15:04:58 +0300 Subject: [PATCH 19/26] Try with PowerShell script. --- appveyor.yml | 7 +------ scripts/appveyor-deploy.ps1 | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 scripts/appveyor-deploy.ps1 diff --git a/appveyor.yml b/appveyor.yml index e1734a9bb..9c001e611 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -255,12 +255,7 @@ notifications: after_test: - if "%DEPLOY%" == "true" (mingw32-make install) -# scripts to run before deployment -before_deploy: - - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py pack .\package\valentina\ ".\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip") - # to run your custom scripts instead of provider deployments deploy_script: - - >- - if "%DEPLOY%" == "true" (python ..\scripts\deploy.py upload %ACCESS_TOKEN% .\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip /0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip) + - ps: ../scripts/appveyor-deploy.ps1 diff --git a/scripts/appveyor-deploy.ps1 b/scripts/appveyor-deploy.ps1 new file mode 100644 index 000000000..474f62b43 --- /dev/null +++ b/scripts/appveyor-deploy.ps1 @@ -0,0 +1,17 @@ +$env:ROOT_FOLDER = "C:\projects\valentina"; +$env:BUILD_FOLDER = "C:\projects\valentina\build"; + +if($env:DEPLOY -eq "true") { + Write-Host "[CI] Starting packing." -ForegroundColor Green; + $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + Write-Host "[CI] Done." -ForegroundColor Green; + + Write-Host "[CI] Uploading." -ForegroundColor Green; + $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + Write-Host "[CI] Uploading has been finished." -ForegroundColor Green; + Exit 0; +} +else { + Write-Host "[CI] No deployment needed." -ForegroundColor Green; + Exit 0; +} From 542008a4ba750a3b412690385a1d79e487be2eec Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 15:14:00 +0300 Subject: [PATCH 20/26] Improvements for the script. --- scripts/appveyor-deploy.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/appveyor-deploy.ps1 b/scripts/appveyor-deploy.ps1 index 474f62b43..f882f5475 100644 --- a/scripts/appveyor-deploy.ps1 +++ b/scripts/appveyor-deploy.ps1 @@ -3,12 +3,22 @@ $env:BUILD_FOLDER = "C:\projects\valentina\build"; if($env:DEPLOY -eq "true") { Write-Host "[CI] Starting packing." -ForegroundColor Green; - $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; - Write-Host "[CI] Done." -ForegroundColor Green; + & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + if ($LastExitCode -ne 0) { + Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult; + exit 1; + } else { + Write-Host "[CI] Done." -ForegroundColor Green; + } Write-Host "[CI] Uploading." -ForegroundColor Green; - $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; - Write-Host "[CI] Uploading has been finished." -ForegroundColor Green; + & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + if ($LastExitCode -ne 0) { + Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult; + exit 1; + } else { + Write-Host "[CI] Uploading has been finished." -ForegroundColor Green; + } Exit 0; } else { From 349f614ec5da7f3ebc2d464116d99e0ce26a009c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 15:46:34 +0300 Subject: [PATCH 21/26] Forgot to fix environment variables. --- scripts/appveyor-deploy.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/appveyor-deploy.ps1 b/scripts/appveyor-deploy.ps1 index f882f5475..c92d1a3d5 100644 --- a/scripts/appveyor-deploy.ps1 +++ b/scripts/appveyor-deploy.ps1 @@ -3,7 +3,7 @@ $env:BUILD_FOLDER = "C:\projects\valentina\build"; if($env:DEPLOY -eq "true") { Write-Host "[CI] Starting packing." -ForegroundColor Green; - & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip"; if ($LastExitCode -ne 0) { Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult; exit 1; @@ -12,7 +12,7 @@ if($env:DEPLOY -eq "true") { } Write-Host "[CI] Uploading." -ForegroundColor Green; - & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip" "/0.7.x/Windows/valentina-win-$(PLATFORM)-$(QT_VERSION)-$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT).zip"; + & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip" "/0.7.x/Windows/valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip"; if ($LastExitCode -ne 0) { Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult; exit 1; From aa6e4f0bf35eae9d718e6cde928a4cb3c94bf708 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 16:43:04 +0300 Subject: [PATCH 22/26] Name of an archive must not contain ".". --- appveyor.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9c001e611..eb03ae589 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,7 +42,7 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.15\mingw81_32 - QT_VERSION: Qt5.15 + QT_VERSION: Qt5_15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_32\bin PYTHON: "C:\\Python38-x64" @@ -50,7 +50,7 @@ environment: DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 QT5: Qt\5.6\mingw49_32 - QT_VERSION: Qt5.6 + QT_VERSION: Qt5_6 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw492_32\bin PYTHON: "C:\\Python38-x64" @@ -58,7 +58,7 @@ environment: DEPLOY: true - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.15\mingw81_64 - QT_VERSION: Qt5.15 + QT_VERSION: Qt5_15 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw810_64\bin PLATFORM: x64 @@ -71,14 +71,14 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.14\mingw73_32 - QT_VERSION: Qt5.14 + QT_VERSION: Qt5_14 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw730_32\bin PLATFORM: x86 DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.14\mingw73_64 - QT_VERSION: Qt5.14 + QT_VERSION: Qt5_14 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw730_64\bin PLATFORM: x64 @@ -91,7 +91,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.13\mingw73_64 - QT_VERSION: Qt5.13 + QT_VERSION: Qt5_13 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw730_64\bin PLATFORM: x64 @@ -104,7 +104,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 QT5: Qt\5.12\mingw73_64 - QT_VERSION: Qt5.12 + QT_VERSION: Qt5_12 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw730_64\bin PLATFORM: x64 @@ -117,7 +117,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 QT5: Qt\5.11\mingw53_32 - QT_VERSION: Qt5.11 + QT_VERSION: Qt5_11 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw530_32\bin PLATFORM: x86 @@ -130,7 +130,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 QT5: Qt\5.10\mingw53_32 - QT_VERSION: Qt5.10 + QT_VERSION: Qt5_10 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw530_32\bin PLATFORM: x86 @@ -143,7 +143,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 QT5: Qt\5.9\mingw53_32 - QT_VERSION: Qt5.9 + QT_VERSION: Qt5_9 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw530_32\bin PLATFORM: x86 @@ -156,7 +156,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 QT5: Qt\5.7\mingw53_32 - QT_VERSION: Qt5.7 + QT_VERSION: Qt5_7 QMAKE_GENERATOR: "MinGW Makefiles" MINGW_PATH: C:\Qt\Tools\mingw530_32\bin PLATFORM: x86 @@ -169,7 +169,7 @@ environment: DEPLOY: false - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 QT5: Qt\5.6\msvc2015_64 - QT_VERSION: Qt5.6 + QT_VERSION: Qt5_6 QMAKE_GENERATOR: "NMake Makefiles JOM" VSVER: 14 PLATFORM: x64 From 2bbaabf6ceae26df6610865212ce96cee7ed01a9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 16:43:50 +0300 Subject: [PATCH 23/26] Use a better compression algorithm. --- scripts/appveyor-deploy.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/appveyor-deploy.ps1 b/scripts/appveyor-deploy.ps1 index c92d1a3d5..d52604644 100644 --- a/scripts/appveyor-deploy.ps1 +++ b/scripts/appveyor-deploy.ps1 @@ -3,7 +3,7 @@ $env:BUILD_FOLDER = "C:\projects\valentina\build"; if($env:DEPLOY -eq "true") { Write-Host "[CI] Starting packing." -ForegroundColor Green; - & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip"; + & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.tar.xz"; if ($LastExitCode -ne 0) { Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult; exit 1; From 25aa17bb603ad1408421c234675532de4009f53f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 16:46:12 +0300 Subject: [PATCH 24/26] Switch to a better compression algorithm. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8e41eed9..eede29a3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -141,9 +141,9 @@ after_success: ../scripts/macfixqtdylibrpath.py $TRAVIS_BUILD_DIR/build/src/app/valentina/bin/Valentina.app; if [[ "$LEGACY" = false ]]; then tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}.tar.xz"; else tar -C $TRAVIS_BUILD_DIR/build/src/app/valentina/bin --exclude "*.DS_Store" -cvzf valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz Valentina.app/; - python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz"; + python3 $TRAVIS_BUILD_DIR/scripts/deploy.py upload $ACCESS_TOKEN $TRAVIS_BUILD_DIR/build/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.gz "/0.7.x/Mac OS X/valentina-osx-${TRAVIS_COMMIT}-legacy.tar.xz"; fi fi From 7f646377988e9c3fef5676c3d0c14954d236a290 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 16:47:07 +0300 Subject: [PATCH 25/26] No longer need this file. --- share/bintray.json | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 share/bintray.json diff --git a/share/bintray.json b/share/bintray.json deleted file mode 100644 index 3066445f8..000000000 --- a/share/bintray.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "package": { - "name": "valentina-osx_auto-upload", - "repo": "Valentina", - "subject": "dismine", - "desc": "Was pushed completely automatically", - "website_url": "https://valentinaproject.bitbucket.io", - "issue_tracker_url": "https://gitlab.com/smart-pattern/valentina/-/issues", - "vcs_url": "https://gitlab.com/smart-pattern/valentina", - "github_use_tag_release_notes": false, - "licenses": ["GPL-3.0"], - "labels": ["patternmaking"], - "public_download_numbers": false, - "public_stats": false - }, - - "version": { - "name": "0.7.46", - "desc": "Test branch release", - "released": "2021-03-31", - "vcs_tag": "v0.7.46", - "gpgSign": false - }, - - "files": - [ - {"includePattern": "./(valentina-osx-.*\\.tar.gz)", "uploadPattern": "$1", - "matrixParams": { - "override": 1 } - } - ], - "publish": true -} From 92eaf1000db1b50aa3f6c45817fd59a1728b8270 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 3 May 2021 17:32:50 +0300 Subject: [PATCH 26/26] Improve the deployment script. --- scripts/appveyor-deploy.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/appveyor-deploy.ps1 b/scripts/appveyor-deploy.ps1 index d52604644..8c06e907b 100644 --- a/scripts/appveyor-deploy.ps1 +++ b/scripts/appveyor-deploy.ps1 @@ -1,9 +1,11 @@ $env:ROOT_FOLDER = "C:\projects\valentina"; -$env:BUILD_FOLDER = "C:\projects\valentina\build"; +$env:BUILD_FOLDER = "$env:ROOT_FOLDER\build"; + +$file_name = "valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.tar.xz"; if($env:DEPLOY -eq "true") { Write-Host "[CI] Starting packing." -ForegroundColor Green; - & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py pack .\package\valentina\ "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.tar.xz"; + & $env:PYTHON\python.exe "$env:ROOT_FOLDER\scripts\deploy.py" pack "$env:BUILD_FOLDER\package\valentina" "$env:BUILD_FOLDER\package\$file_name"; if ($LastExitCode -ne 0) { Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult; exit 1; @@ -12,7 +14,7 @@ if($env:DEPLOY -eq "true") { } Write-Host "[CI] Uploading." -ForegroundColor Green; - & $env:PYTHON\python.exe $env:ROOT_FOLDER\scripts\deploy.py upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip" "/0.7.x/Windows/valentina-win-$env:PLATFORM-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT.zip"; + & $env:PYTHON\python.exe "$env:ROOT_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\package\$file_name" "/0.7.x/Windows/$file_name"; if ($LastExitCode -ne 0) { Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult; exit 1;