瀏覽代碼

add a build script

omassot 6 年之前
父節點
當前提交
6ddc6934c2
共有 2 個文件被更改,包括 62 次插入39 次删除
  1. 62 0
      build.py
  2. 0 39
      metadata.txt

+ 62 - 0
build.py

@@ -0,0 +1,62 @@
+'''
+
+@author: olivier.massot, 2019
+'''
+import configparser
+from core import constants
+from zipfile import ZipFile
+
+from path import Path
+
+
+build_dir = constants.MAIN / "build"
+version = constants.VERSION
+
+name = f"MnCheck_v{version}.zip"
+
+config = configparser.ConfigParser()
+
+config["general"] = {"name" : "MnCheck",
+                    "qgisminimumversion" : "3.4",
+                    "description" : "Contrôle des données FTTH format MN",
+                    "version" : version,
+                    "author" : "Manche Numérique 2019",
+                    "email" : constants.CONTACT,
+                    "about" : "Auto-contrôle des livrables FTTH aux formats Manche Numérique",
+                    "tracker" : "",
+                    "repository" : "",
+                    "tags" : "python",
+                    "homepage" : "http://www.manchenumerique.fr/",
+                    "category" : "Plugins",
+                    "icon" : "icon.png",
+                    "experimental" : "False",
+                    "deprecated" : "False"}
+
+with open(build_dir / 'metadata.txt', 'w+') as mdf:
+    config.write(mdf)
+
+with ZipFile(build_dir / name, 'w') as zip_:
+    
+    def _zip_write(p):
+        if p.ext == ".pyc":
+            return
+        zip_.write(p, p.relpath(constants.MAIN))
+    
+    for f in Path(constants.MAIN / "ext").walkfiles():
+        _zip_write(f)
+    for f in Path(constants.MAIN / "core").walkfiles():
+        _zip_write(f)
+    for f in Path(constants.MAIN / "schemas").walkfiles():
+        _zip_write(f)
+    for f in Path(constants.MAIN / "ui").walkfiles():
+        _zip_write(f)
+    
+    _zip_write(constants.MAIN / "__init__.py")
+    _zip_write(constants.MAIN / "main.py")
+    _zip_write(constants.MAIN / "README.md")
+    _zip_write(constants.MAIN / "icon.png")
+    _zip_write(constants.MAIN / "LICENSE")
+    
+    zip_.write(build_dir / "metadata.txt", "metadata.txt")
+    
+Path(build_dir / "metadata.txt").remove_p()

+ 0 - 39
metadata.txt

@@ -1,39 +0,0 @@
-# This file contains metadata for your plugin. Since 
-# version 2.0 of QGIS this is the proper way to supply 
-# information about a plugin. The old method of 
-# embedding metadata in __init__.py will 
-# is no longer supported since version 2.0.
-
-# This file should be included when you package your plugin.# Mandatory items:
-
-[general]
-name=MnCheck
-qgisMinimumVersion=3.0
-description=Contrôle des données FTTH format MN
-version=0.7.3
-author=Manche Numérique 2019
-email=sig@manchenumerique.fr
-
-about=Auto-contrôle des livrables FTTH aux formats Manche Numérique
-
-tracker=
-repository=
-# End of mandatory metadata
-
-# Recommended items:
-
-# Uncomment the following line and add your changelog:
-# changelog=
-
-# Tags are comma separated with spaces allowed
-tags=python
-
-homepage=http://www.manchenumerique.fr/
-category=Plugins
-icon=icon.png
-# experimental flag
-experimental=False
-
-# deprecated flag (applies to the whole plugin, not just a single version)
-deprecated=False
-