Update zaz and easymacro
This commit is contained in:
parent
0d2c5cff91
commit
233a7c1fbf
|
@ -1,5 +1,5 @@
|
|||
v 0.5.0 [0-mar-2020]
|
||||
-
|
||||
v 0.5.0 [09-jul-2020]
|
||||
- Test install pandas
|
||||
|
||||
v 0.4.0 [10-mar-2020]
|
||||
- Update easymacro.py
|
||||
|
@ -12,11 +12,9 @@ v 0.3.0 [12-nov-2019]
|
|||
|
||||
|
||||
v 0.2.0 [18-oct-2019]
|
||||
---------------------
|
||||
- Add spanish
|
||||
|
||||
|
||||
v 0.1.0 [18-oct-2019]
|
||||
---------------------
|
||||
- Initial version
|
||||
|
||||
|
|
2
conf.py
2
conf.py
|
@ -36,7 +36,7 @@ ID = 'net.elmau.zaz.pip'
|
|||
|
||||
# ~ If you extension will be multilanguage set: True
|
||||
# ~ This feature used gettext, set pythonpath and easymacro in True
|
||||
# ~ Yu can used PoEdit for edit PO files and generate MO files.
|
||||
# ~ You can used PoEdit for edit PO files and generate MO files.
|
||||
# ~ https://poedit.net/
|
||||
USE_LOCALES = True
|
||||
DOMAIN = 'base'
|
||||
|
|
7555
easymacro.py
7555
easymacro.py
File diff suppressed because it is too large
Load Diff
|
@ -13,11 +13,17 @@ PIP = 'pip'
|
|||
|
||||
|
||||
PACKAGES = {
|
||||
'cffi': 'ok.png',
|
||||
'cryptography': 'ok.png',
|
||||
'httpx': 'ok.png',
|
||||
'lxml': 'ok.png',
|
||||
'numpy': 'ok.png',
|
||||
'pandas': 'ok.png',
|
||||
'psycopg2-binary': 'ok.png',
|
||||
'peewee': 'ok.png',
|
||||
'numpy': 'ok.png',
|
||||
'pillow': 'ok.png',
|
||||
'pytesseract': 'ok.png',
|
||||
'sounddevice': 'ok.png',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
# ~ This file is part of ZAZ.
|
||||
|
||||
# ~ https://git.elmau.net/elmau/zaz
|
||||
|
||||
# ~ ZAZ is free software: you can redistribute it and/or modify
|
||||
# ~ it under the terms of the GNU General Public License as published by
|
||||
# ~ the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -19,6 +21,7 @@
|
|||
|
||||
import argparse
|
||||
import os
|
||||
import py_compile
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
|
@ -43,6 +46,10 @@ from conf import (
|
|||
log)
|
||||
|
||||
|
||||
EASYMACRO_TMP = 'easymacro2.py'
|
||||
EASYMACRO = 'easymacro.py'
|
||||
|
||||
|
||||
class LiboXML(object):
|
||||
CONTEXT = {
|
||||
'calc': 'com.sun.star.sheet.SpreadsheetDocument',
|
||||
|
@ -55,6 +62,7 @@ class LiboXML(object):
|
|||
}
|
||||
TYPES = {
|
||||
'py': 'application/vnd.sun.star.uno-component;type=Python',
|
||||
'pyc': 'application/binary',
|
||||
'zip': 'application/binary',
|
||||
'xcu': 'application/vnd.sun.star.configuration-data',
|
||||
'rdb': 'application/vnd.sun.star.uno-typelibrary;type=RDB',
|
||||
|
@ -121,8 +129,8 @@ class LiboXML(object):
|
|||
def parse_manifest(self, data):
|
||||
ET.register_namespace('manifest', self.NS_MANIFEST['manifest'])
|
||||
self._manifest = ET.fromstring(data)
|
||||
data = {'xmlns:loext': self.NS_MANIFEST['xmlns:loext']}
|
||||
self._manifest.attrib.update(**data)
|
||||
attr = {'xmlns:loext': self.NS_MANIFEST['xmlns:loext']}
|
||||
self._manifest.attrib.update(**attr)
|
||||
self._clean('manifest', self._manifest)
|
||||
return
|
||||
|
||||
|
@ -547,7 +555,7 @@ def _update_files():
|
|||
copyfile(source, target)
|
||||
|
||||
if FILES['easymacro']:
|
||||
source = 'easymacro.py'
|
||||
source = EASYMACRO
|
||||
target = _join(path_source, 'pythonpath', source)
|
||||
copyfile(source, target)
|
||||
|
||||
|
@ -593,7 +601,7 @@ def _update_files():
|
|||
return
|
||||
|
||||
|
||||
def _new():
|
||||
def _create():
|
||||
if not _validate_new():
|
||||
return
|
||||
|
||||
|
@ -615,7 +623,7 @@ def _get_info_path(path):
|
|||
|
||||
def _zip_embed(source, files):
|
||||
PATH = 'Scripts/python/'
|
||||
EASYMACRO = 'easymacro.'
|
||||
FILE_PYC = 'easymacro.pyc'
|
||||
|
||||
p, f, name, e = _get_info_path(source)
|
||||
now = datetime.now().strftime('_%Y%m%d_%H%M%S')
|
||||
|
@ -623,12 +631,10 @@ def _zip_embed(source, files):
|
|||
copyfile(source, path_source)
|
||||
target = source
|
||||
|
||||
with zipfile.PyZipFile(EASYMACRO + 'zip', mode='w') as zf:
|
||||
zf.writepy(EASYMACRO + 'py')
|
||||
|
||||
py_compile.compile(EASYMACRO, FILE_PYC)
|
||||
xml = LiboXML()
|
||||
|
||||
path_easymacro = PATH + EASYMACRO + 'zip'
|
||||
path_easymacro = PATH + FILE_PYC
|
||||
names = [f[1] for f in files] + [path_easymacro]
|
||||
nodes = []
|
||||
with zipfile.ZipFile(target, 'w', compression=zipfile.ZIP_DEFLATED) as zt:
|
||||
|
@ -647,14 +653,14 @@ def _zip_embed(source, files):
|
|||
data.append(name)
|
||||
zt.write(path, name)
|
||||
|
||||
zt.write(EASYMACRO + 'zip', path_easymacro)
|
||||
zt.write(FILE_PYC, path_easymacro)
|
||||
data.append(path_easymacro)
|
||||
|
||||
xml.parse_manifest(xml_manifest)
|
||||
xml_manifest = xml.add_data_manifest(data)
|
||||
zt.writestr(path_manifest, xml_manifest)
|
||||
|
||||
os.unlink(EASYMACRO + 'zip')
|
||||
os.unlink(FILE_PYC)
|
||||
return
|
||||
|
||||
|
||||
|
@ -692,8 +698,6 @@ def _embed(args):
|
|||
|
||||
|
||||
def _locales(args):
|
||||
EASYMACRO = 'easymacro.py'
|
||||
|
||||
if args.files:
|
||||
files = args.files.split(',')
|
||||
else:
|
||||
|
@ -725,8 +729,39 @@ def _update():
|
|||
return
|
||||
|
||||
|
||||
def _new(args):
|
||||
if not args.target:
|
||||
msg = 'Add argument target: -t PATH_TARGET'
|
||||
log.error(msg)
|
||||
return
|
||||
|
||||
if not args.name:
|
||||
msg = 'Add argument name: -n name-new-extension'
|
||||
log.error(msg)
|
||||
return
|
||||
|
||||
path = _join(args.target, args.name)
|
||||
_mkdir(path)
|
||||
_mkdir(_join(path, 'files'))
|
||||
_mkdir(_join(path, 'images'))
|
||||
path_logo = 'images/pymacros.png'
|
||||
copyfile(path_logo, _join(path, 'images/logo.png'))
|
||||
copyfile('zaz.py', _join(path, 'zaz.py'))
|
||||
copyfile(EASYMACRO_TMP, _join(path, 'easymacro.py'))
|
||||
copyfile('conf.py.example', _join(path, 'conf.py'))
|
||||
|
||||
msg = 'Folders and files copy successfully for new extension.'
|
||||
log.info(msg)
|
||||
msg = f'Change to folder: {path}'
|
||||
log.info(msg)
|
||||
return
|
||||
|
||||
|
||||
def main(args):
|
||||
if args.new:
|
||||
_new(args)
|
||||
return
|
||||
|
||||
if args.update:
|
||||
_update()
|
||||
return
|
||||
|
@ -739,14 +774,16 @@ def main(args):
|
|||
_embed(args)
|
||||
return
|
||||
|
||||
if args.new:
|
||||
_new()
|
||||
if args.create:
|
||||
_create()
|
||||
return
|
||||
|
||||
if not _validate_update():
|
||||
return
|
||||
|
||||
_update_files()
|
||||
if not args.only_compress:
|
||||
_update_files()
|
||||
|
||||
_compress_oxt()
|
||||
|
||||
if args.install:
|
||||
|
@ -759,9 +796,13 @@ def main(args):
|
|||
def _process_command_line_arguments():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Make LibreOffice extensions')
|
||||
parser.add_argument('-i', '--install', dest='install', action='store_true',
|
||||
parser.add_argument('-new', '--new', dest='new', action='store_true',
|
||||
default=False, required=False)
|
||||
parser.add_argument('-n', '--new', dest='new', action='store_true',
|
||||
parser.add_argument('-t', '--target', dest='target', default='')
|
||||
parser.add_argument('-n', '--name', dest='name', default='', required=False)
|
||||
parser.add_argument('-c', '--create', dest='create', action='store_true',
|
||||
default=False, required=False)
|
||||
parser.add_argument('-i', '--install', dest='install', action='store_true',
|
||||
default=False, required=False)
|
||||
parser.add_argument('-e', '--embed', dest='embed', action='store_true',
|
||||
default=False, required=False)
|
||||
|
@ -771,6 +812,8 @@ def _process_command_line_arguments():
|
|||
default=False, required=False)
|
||||
parser.add_argument('-u', '--update', dest='update', action='store_true',
|
||||
default=False, required=False)
|
||||
parser.add_argument('-oc', '--only_compress', dest='only_compress',
|
||||
action='store_true', default=False, required=False)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue