@@ -37,96 +37,132 @@ jobs:
3737
3838 - name : Create PyInstaller spec file
3939 run : |
40- cat > android-bloatware-remover.spec << 'EOF'
41- # -*- mode: python ; coding: utf-8 -*-
42-
43- block_cipher = None
44-
45- # Collect all brand directories and their contents
46- brand_dirs = ['Samsung', 'Xiaomi', 'Oppo', 'Vivo', 'Realme', 'Tecno', 'OnePlus', 'Huawei', 'Honor', 'Motorola', 'Nothing']
47- datas = []
48-
49- # Add brand directories
50- for brand in brand_dirs:
51- datas.append((f'{brand}/*.md', f'{brand}/'))
52- datas.append((f'{brand}/*.py', f'{brand}/'))
53-
54- # Add core module
55- datas.append(('core/*.py', 'core/'))
56-
57- # Add other files
58- datas.append(('README.md', '.'))
59- datas.append(('LICENSE', '.'))
60-
61- a = Analysis(
62- ['main.py'],
63- pathex=[],
64- binaries=[],
65- datas=datas,
66- hiddenimports=[
67- 'Samsung.samsung_remover',
68- 'Xiaomi.xiaomi_remover',
69- 'Oppo.oppo_remover',
70- 'Vivo.vivo_remover',
71- 'Realme.realme_remover',
72- 'Tecno.tecno_remover',
73- 'OnePlus.oneplus_remover',
74- 'Huawei.huawei_remover',
75- 'Honor.honor_remover',
76- 'Motorola.motorola_remover',
77- 'Nothing.nothing_remover',
78- 'core.bloatware_remover'
79- ],
80- hookspath=[],
81- hooksconfig={},
82- runtime_hooks=[],
83- excludes=[],
84- win_no_prefer_redirects=False,
85- win_private_assemblies=False,
86- cipher=block_cipher,
87- noarchive=False,
88- )
89-
90- pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
91-
92- exe = EXE(
93- pyz,
94- a.scripts,
95- a.binaries,
96- a.zipfiles,
97- a.datas,
98- [],
99- name='android-bloatware-remover',
100- debug=False,
101- bootloader_ignore_signals=False,
102- strip=False,
103- upx=True,
104- upx_exclude=[],
105- runtime_tmpdir=None,
106- console=True,
107- disable_windowed_traceback=False,
108- argv_emulation=False,
109- target_arch=None,
110- codesign_identity=None,
111- entitlements_file=None,
112- )
113- EOF
40+ python -c "
41+ import os
42+ spec_content = '''# -*- mode: python ; coding: utf-8 -*-
43+ import os
44+
45+ block_cipher = None
46+
47+ # Collect all brand directories and their contents
48+ brand_dirs = ['Samsung', 'Xiaomi', 'Oppo', 'Vivo', 'Realme', 'Tecno', 'OnePlus', 'Huawei', 'Honor', 'Motorola', 'Nothing']
49+ datas = []
50+
51+ # Add brand directories (only if they exist)
52+ for brand in brand_dirs :
53+ if os.path.exists(brand) :
54+ md_files = os.path.join(brand, '*.md')
55+ py_files = os.path.join(brand, '*.py')
56+ datas.append((md_files, brand + '/'))
57+ datas.append((py_files, brand + '/'))
58+
59+ # Add core module
60+ if os.path.exists('core') :
61+ datas.append(('core/*.py', 'core/'))
62+
63+ # Add other files (only if they exist)
64+ if os.path.exists('README.md') :
65+ datas.append(('README.md', '.'))
66+ if os.path.exists('LICENSE') :
67+ datas.append(('LICENSE', '.'))
68+
69+ a = Analysis(
70+ ['main.py'],
71+ pathex=[os.getcwd()],
72+ binaries=[],
73+ datas=datas,
74+ hiddenimports=[
75+ ' Samsung.samsung_remover' ,
76+ ' Xiaomi.xiaomi_remover' ,
77+ ' Oppo.oppo_remover' ,
78+ ' Vivo.vivo_remover' ,
79+ ' Realme.realme_remover' ,
80+ ' Tecno.tecno_remover' ,
81+ ' OnePlus.oneplus_remover' ,
82+ ' Huawei.huawei_remover' ,
83+ ' Honor.honor_remover' ,
84+ ' Motorola.motorola_remover' ,
85+ ' Nothing.nothing_remover' ,
86+ ' core.bloatware_remover' ,
87+ ' device_detector' ,
88+ ' version'
89+ ],
90+ hookspath=[],
91+ hooksconfig={},
92+ runtime_hooks=[],
93+ excludes=[],
94+ win_no_prefer_redirects=False,
95+ win_private_assemblies=False,
96+ cipher=block_cipher,
97+ noarchive=False,
98+ )
99+
100+ pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
101+
102+ exe = EXE(
103+ pyz,
104+ a.scripts,
105+ a.binaries,
106+ a.zipfiles,
107+ a.datas,
108+ [],
109+ name='android-bloatware-remover',
110+ debug=False,
111+ bootloader_ignore_signals=False,
112+ strip=False,
113+ upx=False,
114+ upx_exclude=[],
115+ runtime_tmpdir=None,
116+ console=True,
117+ disable_windowed_traceback=False,
118+ argv_emulation=False,
119+ target_arch=None,
120+ codesign_identity=None,
121+ entitlements_file=None,
122+ )
123+ ' ''
124+ with open(' android-bloatware-remover.spec', 'w') as f:
125+ f.write(spec_content)
126+ print('Spec file created successfully')
127+ "
114128
115129 - name: Build with PyInstaller
116130 run: |
117- pyinstaller android-bloatware-remover.spec --clean
131+ echo " Building with PyInstaller..."
132+ echo "Current directory : $(pwd)"
133+ echo "Files in current directory:"
134+ ls -la
135+ echo "Building executable..."
136+ pyinstaller android-bloatware-remover.spec --clean --log-level INFO
137+ echo "Build completed. Checking dist directory:"
138+ ls -la dist/ || echo "dist directory not found"
118139
119140 - name : Test executable (Windows)
120141 if : matrix.os == 'windows-latest'
121142 run : |
122- dist/android-bloatware-remover.exe --test
143+ echo "Testing Windows executable..."
144+ if (Test-Path "dist/android-bloatware-remover.exe") {
145+ echo "Executable exists, running test..."
146+ Start-Process -FilePath "dist/android-bloatware-remover.exe" -ArgumentList "--test" -Wait -NoNewWindow -PassThru
147+ } else {
148+ echo "Executable not found!"
149+ exit 1
150+ }
151+ shell : powershell
123152 timeout-minutes : 2
124153
125154 - name : Test executable (Unix)
126155 if : matrix.os != 'windows-latest'
127156 run : |
128- chmod +x dist/android-bloatware-remover
129- timeout 30s dist/android-bloatware-remover --test || true
157+ echo "Testing Unix executable..."
158+ if [ -f "dist/android-bloatware-remover" ]; then
159+ echo "Executable exists, running test..."
160+ chmod +x dist/android-bloatware-remover
161+ timeout 30s dist/android-bloatware-remover --test || echo "Test completed with timeout"
162+ else
163+ echo "Executable not found!"
164+ exit 1
165+ fi
130166
131167 - name : Upload artifact
132168 uses : actions/upload-artifact@v4
0 commit comments