Skip to content

Commit 1702637

Browse files
committed
Refactor build process and update dependencies; add versioning support and improve error handling
1 parent 1854a0e commit 1702637

File tree

10 files changed

+57
-19
lines changed

10 files changed

+57
-19
lines changed

.github/workflows/desktop.build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959

6060
# --- Build GUI ---
6161
- name: Install GUI dependencies (includes Kivy)
62-
run: pip install -r requirements.kivy.txt # This should include CLI deps too
62+
run: pip install .
6363

6464

6565
- name: Build GUI executable (${{ matrix.os_name }})
@@ -92,8 +92,8 @@ jobs:
9292
mkdir -p artifacts
9393
# Ensure the source path exists before moving
9494
if [ -e "${{ matrix.artifact_path_gui }}" ]; then
95-
echo "Moving ${{ matrix.artifact_path_gui }} to artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }}"
96-
mv ${{ matrix.artifact_path_gui }} artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }}
95+
echo "Moving ${{ matrix.artifact_path_gui }} to artifacts/fiscalberry-${{ matrix.asset_suffix_gui }}"
96+
mv ${{ matrix.artifact_path_gui }} artifacts/fiscalberry-${{ matrix.asset_suffix_gui }}
9797
else
9898
echo "ERROR: Source file ${{ matrix.artifact_path_gui }} not found!"
9999
# Optionally fail the step: exit 1

file_version_info.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# file_version_info.txt
2+
VSVersionInfo(
3+
ffi=FixedFileInfo(
4+
filevers=(1, 0, 0, 0),
5+
prodvers=(1, 0, 0, 0),
6+
mask=0x3f,
7+
flags=0x0,
8+
OS=0x40004,
9+
fileType=0x1,
10+
subtype=0x0,
11+
date=(0, 0)
12+
),
13+
kids=[
14+
StringFileInfo(
15+
[
16+
StringTable(
17+
u'040904B0',
18+
[StringStruct(u'CompanyName', u'Plus Abstracta'),
19+
StringStruct(u'FileDescription', u'Servidor de Impresion GUI Application'),
20+
StringStruct(u'FileVersion', u'2.0.1.0'),
21+
StringStruct(u'InternalName', u'fiscalberry'),
22+
StringStruct(u'LegalCopyright', u'© Plus Abstracta SRL. All rights reserved.'),
23+
StringStruct(u'OriginalFilename', u'fiscalberry-gui.exe'),
24+
StringStruct(u'ProductName', u'Fiscalberry'),
25+
StringStruct(u'ProductVersion', u'1.0.0.0')])
26+
]),
27+
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
28+
]
29+
)

fiscalberry-gui.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exe = EXE(
2626
debug=False,
2727
bootloader_ignore_signals=False,
2828
strip=False,
29-
upx=True,
29+
upx=False,
3030
upx_exclude=[],
3131
runtime_tmpdir=None,
3232
console=False,
@@ -36,4 +36,6 @@ exe = EXE(
3636
codesign_identity=None,
3737
entitlements_file=None,
3838
icon=['src/fiscalberry/ui/assets/fiscalberry.ico'],
39+
version='file_version_info.txt', # Add a version file (see below)
40+
uac_admin=False, # Don't request admin privileges unless necessary
3941
)

requirements.kivy.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
python-escpos[all]==3.1
2-
python-socketio[client]==5.11.4
3-
requests==2.32.3
4-
platformdirs==4.2.2
5-
pika
6-
pywin32; sys_platform == 'win32'
71
kivy[base]==2.3.1

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
python-escpos[all]==3.1
2+
python-socketio[client]==5.11.4
3+
requests==2.32.3
4+
platformdirs==4.2.2
5+
pika
6+
pywin32; sys_platform == 'win32'

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ def load_requirements(filename):
66
return [line.strip() for line in req_file
77
if line.strip() and not line.startswith("#")]
88

9-
requirements_file = os.path.join(os.path.dirname(__file__), "requirements.kivy.txt")
10-
requirements = load_requirements(requirements_file)
119

1210
setup(
1311
name='fiscalberry',
@@ -17,7 +15,11 @@ def load_requirements(filename):
1715
author_email='[email protected]',
1816
package_dir={'': 'src'}, # Le decimos que los paquetes están en "src"
1917
packages=find_packages(where='src'), # Esto encontrará "fiscalberry"
20-
install_requires=requirements,
18+
install_requires=load_requirements("requirements.txt"), # Asume que load_requirements está fijo para tomar un nombre de archivo
19+
extras_require={
20+
'cli': load_requirements("requirements.cli.txt"), # Assumes load_requirements is fixed to take a filename
21+
'gui': load_requirements("requirements.kivy.txt"), # Assumes load_requirements is fixed to take a filename
22+
},
2123
entry_points={
2224
'console_scripts': [
2325
'fiscalberry_cli=fiscalberry.cli:main',

src/fiscalberry/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"""
55
Fiscalberry Server Package
66
"""
7+
from fiscalberry.version import VERSION
78

8-
__version__ = "2.0.1" # Example version, update as needed
9+
__version__ = VERSION

src/fiscalberry/cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
logger = getLogger()
88
from fiscalberry.common.service_controller import ServiceController
99

10-
11-
12-
if __name__ == "__main__":
10+
def main():
1311
try:
1412
ServiceController().start()
1513
except Exception as e:
1614
logger.error(f"Error occurred: {e}", exc_info=True)
1715
os._exit(1)
16+
17+
if __name__ == "__main__":
18+
main()
19+

src/fiscalberry/ui/fiscalberry_app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@
1515
import time
1616
import sys
1717
import os
18-
from pkg_resources import get_distribution
1918

2019

20+
from fiscalberry.version import VERSION
21+
2122
class FiscalberryApp(App):
2223
name = StringProperty("Servidor de Impresión")
2324
uuid = StringProperty("")
2425
host = StringProperty("")
2526
tenant = StringProperty("")
2627
siteName = StringProperty("")
2728
siteAlias = StringProperty("")
28-
version = StringProperty( get_distribution("fiscalberry").version )
29+
version = StringProperty( VERSION )
2930

3031

3132
assetpath = os.path.join(os.path.dirname(__file__), "assets")

src/fiscalberry/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = "2.0.1"

0 commit comments

Comments
 (0)