Skip to content

Commit 3e99d46

Browse files
committed
code documentation and the build file update
1 parent 022450c commit 3e99d46

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

build.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ cd dls_barcode
66
REM use to debug the exe file
77
REM pyinstaller --onefile --icon=..\resources\icons\qr_code.ico --debug --clean main.py
88

9-
pyinstaller --onefile --windowed --icon=..\resources\icons\qr_code.ico --clean main.py
9+
pyinstaller --onefile --windowed --icon="C:\Users\rqq82173\PycharmProjects\PuckBarcodeReader\resources\icons\qr_code.ico" --add-data "C:\Users\rqq82173\PycharmProjects\PuckBarcodeReader\resources; C:\Users\rqq82173\PycharmProjects\PuckBarcodeReader\bin" --clean "C:\Users\rqq82173\PycharmProjects\PuckBarcodeReader\dls_barcode\main.py"
1010

1111
move dist\main.exe ..\bin\barcode.exe
1212
rd /S /Q build
1313
rd /S /Q dist
1414
del main.spec
15-
16-
@echo start barcode.exe --config_file .\config.ini>"..\bin\launch_barcode.bat"

docs/code.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ The following steps will help you prepare an appropriate Python environment to r
1717
* PyQt5
1818

1919
* All of these packages can be installed using `pip`. To do this:
20-
* Open cmd.exe (being sure to ‘Run as Administrator’)
20+
* Create a new virtual environment eg.`python3 -m venv my-env`
21+
* activate the environment - run `my-env\Scripts\activate.bat`
2122
* Upgrade pip by typing `pip install –-upgrade pip`
23+
* Install all required packages using pip:
2224
* Install pyperclip by typing `pip install pyperclip`
2325
* Install enum by typing `pip install enum` [only if using Python 2.7]
26+
* Similarly install scipy, numpy, PyQt5 and opencv-python
2427

2528
NOTE: there is a requirements.txt file that was created for use by the CI server Travis. It contains all of the above dependencies except for enum.
2629

@@ -44,18 +47,13 @@ Creating a Self-Contained Executable
4447
====================================
4548
A Python package called [PyInstaller](http://www.pyinstaller.org/) can be used to create a stand-alone windows executable (.exe) file.
4649

47-
Install PyInstaller with `pip install pyinstaller`. Make sure that the correct version of Python is referenced in your system path.
50+
Activate your virtual environment (e.g.run in command line C:\Users\rqq82173\PycharmProjects\python_environments\barcode_qt5\Scripts\activate.bat)
51+
Install PyInstaller with `pip install pyinstaller` (if it is not installed yet).
4852

49-
To create the executable file, run the `build.bat` file. This will create the file `bin\barcode.exe`. This will be fairly large (~40 MB). If everything has worked correctly, this single file will be all that is needed to run the barcode scanner application.
50-
51-
Troubles creating Executable
52-
53-
Whe the path to Python on Pyinstaller contains spaces there an error [failed to create process](https://stackoverflow.com/questions/31808180/installing-pyinstaller-via-pip-leads-to-failed-to-create-process/34546220#34546220) occures.
54-
To get around the porblem call script pyinstaller-script.py.
55-
For example: "C:\Users\Urszula Neuman\AppData\Local\Programs\Python\Python35\python.exe" "C:\Users\Urszula Neuman\AppData\Local\Programs\Python\Python35\Scripts\pyinstaller-script.py" main.py
56-
The result exec file is created in subdirectrory called dist.
57-
58-
NOTE: when creating the executable on a 64bit machine (using Python 3.5.1 32bit) you might get the error ‘No module named pywintypes’. To fix this, try `pip install pypiwin32`.
53+
To create the executable file, run the `build.bat` file. This will create the file `bin\barcode.exe`. This will be fairly large (~40 MB).
54+
'build.bat' includes hardcoded paths to the main file and the icon. This needs to be updated accordingly.
55+
Once .exe file is created add 'resources' folder to th bin folder (resources include the icon and the shape patter).
56+
Zip the bin folder and add it to release files.
5957

6058
Continuous Integration
6159
======================

0 commit comments

Comments
 (0)