diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f5d22c8..d4340be 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,7 +38,7 @@ jobs: key: ${{ runner.os }}-otb-${{ hashFiles('**/main.py') }} restore-keys: | ${{ runner.os }}-otb- - - if: steps.otb-cache.outputs.cache-hit != 'true' + - if: ${{ steps.otb-cache.outputs.cache-hit != 'true'}} name: download OTB-9.0.0-Win64.zip uses: gamedev-thingy/Download-Extract@done with: @@ -74,17 +74,20 @@ jobs: - name: building and pack run: | - mkdir "dist/win-unpacked/bin/OTB-9.0.0-Win64" pip install -r requirements.txt - pip install nuitka - nuitka main.py + pip install pyinstaller + pyinstaller main.py npm install npm run pack + + cp -r "data" "dist/main" + cp -r "dist/main" "." + ren "main" "bin" - cp -r "data" "main.dist" - ren "main.dist" "bin" - cp -r "bin" "dist/win-unpacked/" + cp -r "bin" "dist/win-unpacked" cp -r "OTB-9.0.0-Win64" "dist/win-unpacked/bin" + cp -r "data" "dist/win-unpacked/bin" + dir dir dist dir "dist/win-unpacked" dir "dist/win-unpacked/bin" diff --git a/.github/workflows/build_parallel.yaml b/.github/workflows/build_parallel.yaml index d23c83f..e396e8c 100644 --- a/.github/workflows/build_parallel.yaml +++ b/.github/workflows/build_parallel.yaml @@ -62,11 +62,12 @@ jobs: - name: building run: | pip install -r requirements.txt - pip install nuitka - nuitka main.py + pip install pyinstaller + pyinstaller main.py - cp -r "data" "main.dist" - ren "main.dist" "bin" + cp -r "data" "dist/main" + cp -r "dist/main" "." + ren "main" "bin" 7z a -tzip bin.zip bin/* @@ -115,6 +116,7 @@ jobs: run: | npm install npm run pack + tree - name: Upload uses: actions/upload-artifact@v4 @@ -122,14 +124,14 @@ jobs: # Artifact name name: electron_app # A file, directory or wildcard pattern that describes what to upload - path: "build/win-unpacke/*" + path: "dist/win-unpacked" pack_app: needs: [download_otb, build_python_app, build_electron_app] runs-on: windows-latest steps: - uses: actions/checkout@v4 - - uses: actions/download0artifact@v4 + - uses: actions/download-artifact@v4 with: # Name of the artifact to download. # If unspecified, all artifacts for the run are downloaded. @@ -166,23 +168,36 @@ jobs: # Optional. Default is ${{ github.run_id }} # run-id: - - uses: actions/download0artifact@v4 + - uses: actions/download-artifact@v4 with: # Name of the artifact to download. # If unspecified, all artifacts for the run are downloaded. # Optional. - name: OTB-9.0.0-Win64 + name: bin - - uses: actions/download0artifact@v4 + - uses: actions/download-artifact@v4 with: # Name of the artifact to download. # If unspecified, all artifacts for the run are downloaded. # Optional. name: electron_app + path: win_64 - run: | + 7z x -o"win_64" "bin.zip" + 7z x -o"win_64/bin" "OTB-9.0.0-Win64.zip" dir - dir bin - dir electron_app - dir OTB-9.0.0-Win64 - + dir "win_64" + dir "win_64/bin" + dir "win_64/bin/OTB-9.0.0-Win64" + 7z a -tzip win_64.zip win_64/* + + + - name: Upload + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: GFB_2.0_win_64 + # A file, directory or wildcard pattern that describes what to upload + path: "win_64" + diff --git a/.gitignore b/.gitignore index afbb42c..00acad9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,9 +13,13 @@ main.build/ main.dist/ main.onefile-build main.exe +main.spec # venv venv/ # vscode .vscode/ + + +build.bat diff --git a/README.md b/README.md index 5a2de7c..27a971d 100644 --- a/README.md +++ b/README.md @@ -66,16 +66,16 @@ ```bash pip install nuitka - nuitka main.py --standalone + pyinstaller main.py ``` - 编译完成后会在目录中生成`main.dist`文件夹, 请`main.dist`文件夹重命名为`bin`。 + 编译完成后会在`dist`目录中生成`main`目录, 请`main`重命名为`bin`。 5. 配置Orfeo Toolbox 下载[Orfeo Toolbox](https://www.orfeo-toolbox.org/download/),并解压。 - 并将解压好的`OTB-*-Win64`文件夹与本项目附带的`data`文件夹一起放入上一步制作的`bin`文件夹中。 + 并将解压好的`OTB-*-Win64`文件夹与本项目附带的`data`文件夹一起放入上一步的`bin`文件夹中。 6. 将`bin`文件夹放入打包好的Electron文件夹中 @@ -87,7 +87,9 @@ 2. 我看不懂编译说明 - 请移步 `Github Action`查看具体执行流程 ,本项目的自动编译由Github Action驱动。 + ~~请移步 `Github Action`查看具体执行流程 ,本项目的自动编译由Github Action驱动。~~ 还没调试好。 + + **请不要在生产环境使用action内编译的版本,他们不一定是稳定的!** 3. 有关跨平台支持 @@ -96,3 +98,11 @@ 可以自行安装对应平台的OTB并修改源码进行尝试。 欢迎提交PR! + +## TODO + +- [ ] 解决action编译版无法使用的问题 + +- [ ] Linux支持 + +- [ ] 支持高分系列15米级数据正射校正 \ No newline at end of file diff --git a/main.py b/main.py index 10f63bc..da25e36 100644 --- a/main.py +++ b/main.py @@ -424,9 +424,8 @@ def get_rasters_name(dataPath): elif glob(join(appPath, 'OTB-*-Win64')): otbPath = glob(join(appPath, 'OTB-*-Win64'))[0] else: - logger.error(f"OTB not found in{os.path.abspath('.')},\n please downl oadfrom https://www.orfeo-toolbox.org/") - logger.error(f"OTB not found in:{appPath},\n please downl oadfrom https://www.orfeo-toolbox.org/") - assert False,f"OTB not found in:{appPath},\n please downl oadfrom https://www.orfeo-toolbox.org/" + logger.error(f"OTB is not found !") + assert False,f"OTB not found in:{appPath},\n please download from https://www.orfeo-toolbox.org" os.environ['GDAL_DATA'] = join(otbPath, r"share\data") diff --git a/main.spec b/main.spec deleted file mode 100644 index 1067762..0000000 --- a/main.spec +++ /dev/null @@ -1,43 +0,0 @@ -# -*- mode: python ; coding: utf-8 -*- - - -a = Analysis( - ['main.py'], - pathex=[], - binaries=[], - datas=[], - hiddenimports=[], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - noarchive=False, -) -pyz = PYZ(a.pure) - -exe = EXE( - pyz, - a.scripts, - [], - exclude_binaries=True, - name='main', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=True, - disable_windowed_traceback=False, - argv_emulation=False, - target_arch=None, - codesign_identity=None, - entitlements_file=None, -) -coll = COLLECT( - exe, - a.binaries, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='main', -) diff --git a/package-lock.json b/package-lock.json index f6e293e..b3741eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -947,6 +947,7 @@ "url": "https://feross.org/support" } ], + "peer": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -1280,7 +1281,8 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/crc-32": { "version": "1.2.2", @@ -2283,7 +2285,8 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "peer": true }, "node_modules/inflight": { "version": "1.0.6",