Joachim M. Giæver 3 anni fa
parent
commit
f5bb18d4cb
1 ha cambiato i file con 40 aggiunte e 5 eliminazioni
  1. 40 5
      snap/snapcraft.yaml

+ 40 - 5
snap/snapcraft.yaml

@@ -79,10 +79,10 @@ grade: stable
 confinement: strict
 
 architectures:
-  # - build-on: amd64
+  - build-on: amd64
   # - build-on: arm64
-  - build-on: armhf
-  - build-on: ppc64el
+  # - build-on: armhf
+  # - build-on: ppc64el
 
 layout:
   /usr/local/lib:
@@ -127,6 +127,7 @@ apps:
     daemon: simple
     environment:
       PIP_USER: 1
+      #PYTHONPATH: "$PYTHONPATH:$SNAP/lib/python3.9/site-packages"
     restart-condition: always
     plugs: 
       - bluez
@@ -150,11 +151,31 @@ apps:
       PIP_USER: 1
     command: bin/hass --script check_config --config $SNAP_DATA -i
 
+package-repositories:
+ - type: apt
+   ppa: deadsnakes/ppa
+
 parts:
+  # python:
+  #   plugin: dump
+  #   source: ./src/nil
+  #   build-packages:
+  #     - python3.9-dev
+  #   stage-packages:
+  #     - python3.9-venv
+  #     - python3.9-distutils
+  #   override-build: |
+  #     snapcraftctl build
+  #     cp -rf $(find /snap -path *python3.9/distutils -print0 -quit) ${SNAPCRAFT_PART_INSTALL}/usr/lib/python3.9
+
   homeassistant:
+    # after: [python]
     plugin: python #-wot-plugin
     source: https://github.com/home-assistant/core.git
     source-tag: ${SNAPCRAFT_PROJECT_VERSION}
+    # build-environment:
+    #   - SNAPCRAFT_PYTHON_INTERPRETER: python3.9
+    #   - SNAPCRAFT_PYTHON_VENV_ARGS: --system-site-packages
     python-packages:
       - setuptools<58
       - wheel
@@ -171,6 +192,7 @@ parts:
       - libavformat-dev
       - libavresample-dev
       - libavutil-dev
+      - libcrypt-dev
       - libffi-dev
       - libglib2.0-dev
       - libglu1-mesa-dev
@@ -185,7 +207,6 @@ parts:
       - libxml2-dev
       - libxslt1-dev
       - pkg-config
-      - python3
       - python3-dev
       - zlib1g-dev
       - on armhf:
@@ -216,6 +237,20 @@ parts:
     constraints:
       - homeassistant/package_constraints.txt
     override-build: |
+      # export PYTHONPATH="/root/parts/python/install/usr/lib/python3.9"
+      # python3.9 -c 'help("modules")'
+      # /root/parts/python/install/usr/bin/python3.9 -c 'help("modules")'
+      # mkdir -p "${SNAPCRAFT_PART_INSTALL}/bin"
+      # ln -sf /root/parts/python/install/usr/bin/python3.9 /root/parts/homeassistant/install/bin/python3.9
+      # /root/parts/homeassistant/install/bin/python3.9 -c 'help("modules")'
+      # rm -rf /var/tmp/*
+      # /root/parts/homeassistant/install/bin/python3.9 -Im ensurepip
+      # IDISTUTILS="$(find ${SNAPCRAFT_PART_INSTALL} -path *python3.9/distutils -print0 -quit)"
+      # UDISTUTILS="$(find /usr -path *python3.9/distutils -print0 -quit)"
+      # rm -rf "${IDISTUTILS}"
+      # cp -r "${UDISTUTILS}" "${IDISTUTILS}"
+      # mkdir -p "${SNAPCRAFT_PART_INSTALL}/usr/include"
+      # cp -r "$(find /usr -path *include/python3.9 -print0 -quit)" "${SNAPCRAFT_PART_INSTALL}/usr/include"
       snapcraftctl build
       sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' $SNAPCRAFT_PART_INSTALL/pyvenv.cfg
   updater:
@@ -224,7 +259,7 @@ parts:
     source: ./src/components
     source-type: local
     organize:
-      '*': lib/python3.8/site-packages/homeassistant/components/
+      '*': lib/python3.9/site-packages/homeassistant/components/
   bins:
     plugin: dump
     source: ./src/bin