diff options
author | rahulp13 | 2020-02-21 13:06:02 +0530 |
---|---|---|
committer | rahulp13 | 2020-02-21 13:06:02 +0530 |
commit | e4c3bf94f0ede7a354a1253f11b1dbf378b49327 (patch) | |
tree | be3c112395490f9ee73cfe8df31d1031f2524f84 /Debian | |
parent | 354759ed869d72744f9f519b0e315e9df329c651 (diff) | |
download | eSim-e4c3bf94f0ede7a354a1253f11b1dbf378b49327.tar.gz eSim-e4c3bf94f0ede7a354a1253f11b1dbf378b49327.tar.bz2 eSim-e4c3bf94f0ede7a354a1253f11b1dbf378b49327.zip |
packaging with pyinstaller
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/eSim.spec | 34 | ||||
-rwxr-xr-x | Debian/install-eSim.sh | 52 | ||||
-rw-r--r-- | Debian/readme.md | 71 |
3 files changed, 124 insertions, 33 deletions
diff --git a/Debian/eSim.spec b/Debian/eSim.spec new file mode 100644 index 00000000..15061f6b --- /dev/null +++ b/Debian/eSim.spec @@ -0,0 +1,34 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + +a = Analysis(['eSim-2.0/src/frontEnd/Application.py'], + pathex=['/home/rahul/Music'], + binaries=[], + datas=[], + hiddenimports=['PyQt4.sip'], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='eSim', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + version='eSim-2.0/VERSION', + icon='eSim-2.0/images/logo.png') diff --git a/Debian/install-eSim.sh b/Debian/install-eSim.sh index eab10ab0..f30226aa 100755 --- a/Debian/install-eSim.sh +++ b/Debian/install-eSim.sh @@ -40,10 +40,10 @@ function createConfigFile echo "[eSim]" >> $config_dir/$config_file echo "eSim_HOME = $eSim_Home" >> $config_dir/$config_file echo "LICENSE = %(eSim_HOME)s/LICENSE" >> $config_dir/$config_file - echo "KicadLib = %(eSim_HOME)s/kicadSchematicLibrary" >> $config_dir/$config_file + echo "KicadLib = %(eSim_HOME)s/library/kicadLibrary.tar.xz" >> $config_dir/$config_file echo "IMAGES = %(eSim_HOME)s/images" >> $config_dir/$config_file echo "VERSION = %(eSim_HOME)s/VERSION" >> $config_dir/$config_file - echo "MODELICA_MAP_JSON = %(eSim_HOME)s/src/ngspicetoModelica/Mapping.json" >> $config_dir/$config_file + echo "MODELICA_MAP_JSON = %(eSim_HOME)s/library/ngspicetoModelica/Mapping.json" >> $config_dir/$config_file } @@ -99,20 +99,6 @@ function installDependency exit 1 fi - echo "Installing PyQt4..........................." - sudo apt-get install -y python3-pyqt4 - if [ $? -ne 0 ]; then - echo -e "\n\n\"PyQt4\" dependency couldn't be installed.\nKindly resolve above errors and try again." - exit 1 - fi - - echo "Installing Matplotlib......................" - sudo apt-get install -y python3-matplotlib - if [ $? -ne 0 ]; then - echo -e "\n\n\"Matplotlib\" dependency couldn't be installed.\nKindly resolve above errors and try again." - exit 1 - fi - echo "Installing KiCad..........................." sudo apt install -y --no-install-recommends kicad if [ $? -ne 0 ]; then @@ -134,15 +120,15 @@ function copyKicadLibrary fi # Dump KiCad config path - echo "$HOME/.config/kicad" >> $eSim_Home/src/supportFiles/kicad_config_path.txt + echo "$HOME/.config/kicad" > $eSim_Home/library/supportFiles/kicad_config_path.txt #Copy fp-lib-table for switching modes - cp -r src/supportFiles/fp-lib-table ~/.config/kicad/ - cp -r src/supportFiles/fp-lib-table-online ~/.config/kicad/ + cp -r library/supportFiles/fp-lib-table ~/.config/kicad/ + cp -r library/supportFiles/fp-lib-table-online ~/.config/kicad/ echo "fp-lib-table copied in the directory" #Extract custom KiCad Library - tar -xJf kicadLibrary.tar.xz + tar -xJf library/kicadLibrary.tar.xz #Copy KiCad libraries echo "Copying KiCad libraries...................." @@ -177,17 +163,21 @@ function copyKicadLibrary function createDesktopStartScript -{ - - # Generating new esim-start.sh - echo "#!/bin/bash" > esim-start.sh - echo "cd $eSim_Home/src/frontEnd" >> esim-start.sh - echo "python3 Application.py" >> esim-start.sh +{ + # Generating new esim-start.sh + echo '#!/bin/bash' > esim-start.sh + echo "cd $eSim_Home" >> esim-start.sh + echo "./eSim" >> esim-start.sh # Make it executable sudo chmod 755 esim-start.sh # Copy esim start script sudo cp -vp esim-start.sh /usr/bin/esim + # Remove local copy of esim start script + rm esim-start.sh + + # Make eSim executable + sudo chmod 755 eSim # Generating esim.desktop file echo "[Desktop Entry]" > esim.desktop @@ -198,7 +188,7 @@ function createDesktopStartScript echo "GenericName=eSim" >> esim.desktop echo "Keywords=eda-tools" >> esim.desktop echo "Exec=esim %u" >> esim.desktop - echo "Terminal=false" >> esim.desktop + echo "Terminal=true" >> esim.desktop echo "X-MultipleArgs=false" >> esim.desktop echo "Type=Application" >> esim.desktop getIcon="$config_dir/logo.png" @@ -304,18 +294,18 @@ if [ $option == "--install" ];then elif [ $option == "--uninstall" ];then - echo -n "Are you sure ? As it will remove complete eSim including your subcircuit and model library packages(y/n):" + echo -n "Are you sure? It will remove complete eSim including KiCad, Ngspice and NGHDL packages(y/n):" read getConfirmation if [ $getConfirmation == "y" -o $getConfirmation == "Y" ];then echo "Removing eSim............................" - sudo rm -rf $HOME/.esim $HOME/Desktop/esim.desktop esim-start.sh esim.desktop /usr/bin/esim + sudo rm -rf $HOME/.esim $HOME/Desktop/esim.desktop esim.desktop /usr/bin/esim echo "Removing KiCad..........................." sudo apt purge -y kicad sudo rm -rf /usr/share/kicad sudo rm -rf $HOME/.config/kicad - rm -f $eSim_Home/src/supportFiles/kicad_config_path.txt + rm -f $eSim_Home/library/supportFiles/kicad_config_path.txt echo "Removing NGHDL..........................." - rm -rf src/modelParamXML/Nghdl/* + rm -rf library/modelParamXML/Nghdl/* cd nghdl/ if [ $? -eq 0 ];then ./install-nghdl.sh --uninstall diff --git a/Debian/readme.md b/Debian/readme.md index 98d8543d..0c35e79c 100644 --- a/Debian/readme.md +++ b/Debian/readme.md @@ -1,16 +1,83 @@ -Ubuntu Installer Documentation +eSim Installer (Ubuntu) ==== -It contains all the documenation for installers on Ubuntu 14.04 and above. +It contains all the documenation for making eSim executable (using PyInstaller) and eSim Installation Script on Ubuntu 14.04 and above. + +## eSim Executable: + +1. Download `virtualenv` package as: + + $ pip install virtualenv + +2. Create a virtual environment as: + + $ virtualenv -p /usr/bin/python3 eSim + +3. Activate the virtual environment as: + + $ source eSim/bin/activate + +4. Install all Python dependencies for eSim within the virtual environment as: + + $ pip install pyinstaller + $ pip install matplotlib + $ pip install --upgrade 'setuptools<45.0.0' + $ sudo apt install build-essential python3-dev libqt4-dev qt4-dev-tools + $ mkdir eSim/build + $ cd eSim/build/ + $ wget http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.12.3/PyQt4_gpl_x11-4.12.3.tar.gz + $ wget https://www.riverbankcomputing.com/static/Downloads/sip/4.19.21/sip-4.19.21.tar.gz + $ tar xzvf sip-4.19.21.tar.gz + $ tar xvzf PyQt4_gpl_x11-4.12.3.tar.gz + $ cd sip-4.19.21/ + $ python configure.py --sip-module PyQt4.sip + $ make + $ make install + $ cd ../PyQt4_gpl_x11-4.12.3/ + $ python configure.py + $ make + $ make install + +5. Now uninstall PyQt4, matplotlib, numpy, dateutil and cycler globally. + +6. Test whether only eSim dependencies are available or not: + + $ pip freeze + +> Note : Following dependencies should be available - +> - PyQt4 +> - matplotlib +> - numpy +> - dateutil +> - pyparsing +> - six +> - cycler.py + +7. Create spec file as: + + $ pyi-makespec --onefile -n eSim <path_to_eSim>/src/frontEnd/Application.py + +8. Add `PyQt4.sip` as hiddenimports in the generated spec file. + +9. Create onefile executable using pyinstaller as: + + $ pyinstaller -F --clean eSim.spec + +10. Verify whether all eSim `src` files (`*.py`) have been included in `Analysis-00.toc` file under the build folder generated by PyInstaller. + + ## How to package eSim? 1. Add the installer file in `eSim-<version>` folder. +2. Add the eSim executable file in `eSim-<version>` folder. 2. Remove following files from the folder: - `.git` folder - `code` folder + - `src` folder - conf.py + - setup.py - index.rst - requirement.txt - .gitignore |