From 80facb3a07a0f3e8d150f37bbb97a127da4fbdae Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Thu, 30 Jul 2020 13:26:27 +0200 Subject: [PATCH] Update build system (#24) --- .github/dependabot.yml | 6 ++ .github/workflows/build.yml | 132 +++++++++++++++++++++--------------- MANIFEST.in | 3 + README.md | 28 ++++++-- requirements.txt | 3 + requirements_build.txt | 6 +- setup.py | 27 +++++--- 7 files changed, 129 insertions(+), 76 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 MANIFEST.in create mode 100644 requirements.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b38df29 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d86c08..54c1d9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,12 @@ name: Build Workflow -on: [push, pull_request] +on: + push: + pull_request: jobs: build-windows: - runs-on: windows-latest + runs-on: windows-2019 steps: - name: Checkout uses: actions/checkout@v1 @@ -13,25 +15,20 @@ jobs: with: python-version: '3.7' architecture: 'x64' - - name: Print Versions - run: | - python --version - pip --version - name: Install requirements run: | - pip install -r requirements_build.txt + pip install -r requirements.txt -r requirements_build.txt pip install -e . - name: Run PyInstaller run: | python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher\__main__.py - - name: See dist directory - run: ls dist - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v2 with: name: Windows path: dist/ESPHome-Flasher.exe + build-windows-x86: - runs-on: windows-latest + runs-on: windows-2019 steps: - name: Checkout uses: actions/checkout@v1 @@ -40,54 +37,48 @@ jobs: with: python-version: '3.7' architecture: 'x86' - - name: Print Versions - run: | - python --version - pip --version - name: Install requirements run: | - pip install -r requirements_build.txt + pip install -r requirements.txt -r requirements_build.txt pip install -e . - name: Run PyInstaller run: | python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher\__main__.py - name: See dist directory run: ls dist - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v2 with: name: Windows-x86 path: dist/ESPHome-Flasher.exe - #build-ubuntu: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v1 - # - name: Install Python - # uses: actions/setup-python@v1 - # with: - # python-version: '3.7' - # - name: Install dependencies - # run: | - # sudo apt install python-wxgtk3.0 build-essential libgtk-3-dev - # - name: Print Versions - # run: | - # python --version - # pip --version - # - name: Install requirements - # run: | - # pip install pathlib2 - # pip install -r requirements_build.txt - # pip install -e . - # - name: Run PyInstaller - # run: | - # python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher/__main__.py - # - name: See dist directory - # run: ls dist - # - uses: actions/upload-artifact@master - # with: - # name: Ubuntu - # path: dist + build-ubuntu: + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Install Python + uses: actions/setup-python@v1 + with: + python-version: '3.7' + - name: Install dependencies + run: | + sudo apt install libgtk-3-dev libnotify-dev libsdl2-dev + pip install -U \ + -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \ + wxPython + - name: Install requirements + run: | + pip install -r requirements.txt -r requirements_build.txt + pip install -e . + - name: Run PyInstaller + run: | + python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.ico esphomeflasher/__main__.py + - name: See dist directory + run: ls dist + - uses: actions/upload-artifact@v2 + with: + name: Ubuntu + path: dist/ESPHome-Flasher build-macos: @@ -99,20 +90,51 @@ jobs: uses: actions/setup-python@v1 with: python-version: '3.7' - - name: Print Versions - run: | - python --version - pip --version - name: Install requirements run: | - pip install -r requirements_build.txt + pip install -r requirements.txt -r requirements_build.txt pip install -e . - name: Run PyInstaller run: | python -m PyInstaller.__main__ -F -w -n ESPHome-Flasher -i icon.icns esphomeflasher/__main__.py - name: See dist directory run: ls dist - - uses: actions/upload-artifact@master + - name: Move app + run: | + mv dist/ESPHome-Flasher.app dist/ESPHome-Flasher-dev-macOS.app + - uses: actions/upload-artifact@v2 with: - name: MacOS - path: dist/ESPHome-Flasher.app + name: macOS + path: dist/ + + build-pypi: + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Install Python + uses: actions/setup-python@v1 + with: + python-version: '3.7' + - name: Install dependencies + run: | + sudo apt install libgtk-3-dev libnotify-dev libsdl2-dev + pip install -U \ + -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \ + wxPython + - name: Install requirements + run: | + pip install -r requirements.txt -r requirements_build.txt + pip install -e . + - name: Run sdist + run: python setup.py sdist bdist_wheel + - name: See dist directory + run: ls dist + - uses: actions/upload-artifact@v2 + with: + name: sdist + path: dist/esphomeflasher-*.tar.gz + - uses: actions/upload-artifact@v2 + with: + name: bdist_wheel + path: dist/esphomeflasher-*.whl diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7b74127 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE +include README.md +include requirements.txt diff --git a/README.md b/README.md index d15f6cd..db37b29 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# esphomeflasher +# ESPHome-Flasher -esphomeflasher is a utility app for the [esphomelib](https://esphomelib.com/esphomeyaml/index.html) -framework and is designed to make flashing ESPs with esphomelib as simple as possible by: +ESPHome-Flasher is a utility app for the [ESPHome](https://esphome.io/) +framework and is designed to make flashing ESPs with ESPHome as simple as possible by: * Having pre-built binaries for most operating systems. * Hiding all non-essential options for flashing. All necessary options for flashing (bootloader, flash mode) are automatically extracted from the binary. - + This project was originally intended to be a simple command-line tool, but then I decided that a GUI would be nice. As I don't like writing graphical -front end code, the GUI largely is based on the +front end code, the GUI largely is based on the [NodeMCU PyFlasher](https://github.com/marcelstoer/nodemcu-pyflasher) project. @@ -19,7 +19,7 @@ library by espressif. ## Installation Es doesn't have to be installed, just double-click it and it'll start. -Check the [releases section](https://github.com/OttoWinter/esphomeflasher/releases) +Check the [releases section](https://github.com/esphome/esphome-flasher/releases) for downloads for your platform. ## Installation Using `pip` @@ -27,7 +27,7 @@ for downloads for your platform. If you want to install this application from `pip`: - Install Python 3.x -- Install [wxPython 4.x](https://wxpython.org/) manually or run `pip3 install wxpython` +- Install [wxPython 4.x](https://wxpython.org/) manually or run `pip3 install wxpython` (see also linux notes below) - Install this project using `pip3 install esphomeflasher` - Start the GUI using `esphomeflasher`. Alternatively, you can use the command line interface ( type `esphomeflasher -h` for info) @@ -42,6 +42,20 @@ If you want to build this application yourself you need to: - Start the GUI using `esphomeflasher`. Alternatively, you can use the command line interface ( type `esphomeflasher -h` for info) + +## Linux Notes + +Installing wxpython for linux can be a bit challenging (especially when you don't want to install from source). +You can use the following command to install a wxpython suitable with your OS: + +```bash +# Go to https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ and select the correct OS type +# here, we assume ubuntu 18.03 bionic +pip3 install -U \ + -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \ + wxPython +``` + ## License [MIT](http://opensource.org/licenses/MIT) © Marcel Stör, Otto Winter diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fa733cf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +wxpython>=4.0,<5.0 +esptool==2.8 +requests>=2.24.0,<3 diff --git a/requirements_build.txt b/requirements_build.txt index 2b1607b..ece22df 100644 --- a/requirements_build.txt +++ b/requirements_build.txt @@ -1,4 +1,2 @@ -wxpython>=4.0,<5.0 -esptool==2.8 -requests>=2.0,<3 -pyinstaller +pyinstaller>=3.6,<4 +wheel diff --git a/setup.py b/setup.py index 8e53d62..9a3295a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ #!/usr/bin/env python """esphomeflasher setup script.""" +import os + from setuptools import setup, find_packages from esphomeflasher import const @@ -8,12 +10,12 @@ PROJECT_NAME = 'esphomeflasher' PROJECT_PACKAGE_NAME = 'esphomeflasher' PROJECT_LICENSE = 'MIT' PROJECT_AUTHOR = 'ESPHome' -PROJECT_COPYRIGHT = '2019, ESPHome' +PROJECT_COPYRIGHT = '2020, ESPHome' PROJECT_URL = 'https://esphome.io/guides/faq.html' PROJECT_EMAIL = 'contact@esphome.io' PROJECT_GITHUB_USERNAME = 'esphome' -PROJECT_GITHUB_REPOSITORY = 'esphomeflasher' +PROJECT_GITHUB_REPOSITORY = 'esphome-flasher' PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME) GITHUB_PATH = '{}/{}'.format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) @@ -21,11 +23,14 @@ GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH) DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, const.__version__) -REQUIRES = [ - 'wxpython>=4.0,<5.0', - 'esptool==2.8', - 'requests>=2.0,<3', -] +here = os.path.abspath(os.path.dirname(__file__)) + +with open(os.path.join(here, 'requirements.txt')) as requirements_txt: + REQUIRES = requirements_txt.read().splitlines() + +with open(os.path.join(here, 'README.md')) as readme: + LONG_DESCRIPTION = readme.read() + setup( name=PROJECT_PACKAGE_NAME, @@ -35,18 +40,20 @@ setup( download_url=DOWNLOAD_URL, author=PROJECT_AUTHOR, author_email=PROJECT_EMAIL, - description="ESP8266/ESP32 firmware flasher for esphomelib", + description="ESP8266/ESP32 firmware flasher for ESPHome", include_package_data=True, zip_safe=False, platforms='any', test_suite='tests', - python_requires='>=3.5', + python_requires='>=3.5,<4.0', install_requires=REQUIRES, + long_description=LONG_DESCRIPTION, + long_description_content_type='text/markdown', keywords=['home', 'automation'], entry_points={ 'console_scripts': [ 'esphomeflasher = esphomeflasher.__main__:main' ] }, - packages=find_packages() + packages=find_packages(include="esphomerelease.*") )