yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.

Home Page:https://django-autocomplete-light.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collectstatic error with whitenoise on 3.9.5 (same as #1281)

qsebas opened this issue · comments

commented

the bug was described in the closed issue #1281 but it was not resolved

a fresh new django project with whitenoise and django-autocomplete-light in installed-app will throw the following error

The CSS file 'vendor/select2/docs/themes/learn2/css/font-awesome.min.css' references a file which could not be found:
  vendor/select2/docs/themes/learn2/fonts/fontawesome-webfont.woff2

Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.

the wierd thing is if I downgrade to 3.8.2, it works, but if I upgrade again to 3.9.5 it continues to work (even if I delete static folder)

to be sure to reproduce the error I have made a dockerfile, you can reproduce the error with a simple

docker build .

Here is the full project with all files needed to reproduce the error
dal-static-error.zip

Attempting to narrow down the problem: versions 3.9.4 and 3.9.5-rc1 work.

Upgrading to versions >= 3.9.5-rc2 causes collectstatic to fail.

commented

No, I've tried with all versions from 3.9.0 to 3.9.5 and all fails, you can try it with the zip file changing the Pipfile and rebuilding the docker

commented

sorry!

I didn't realize that i have a ~= in the Pipfile, so even I've changed the version I was always using 3.9.5

I can confirm you 3.9.4 is working well

We are not supposed to use git modules anymore since a82d150

I failed to use a clean repo prior to running the release script 🤦

3.9.7 release should fix it

Good news is, now that we have a release script, we can add that to a github action that will always run on a clean repo and I'm going to do just that right now 🤣

Thanks! Is it fixed for you with 3.9.7?

Confirmed - fixed in 3.9.7.
Thank you!

Thanks! What a relief 🤣

So, the only preventive bugfix and the last one we can do for this repo, is make github action to do the npm build

But it fails miserably to let npm copy a file because of a proclaimed permission error nevermind the fact that copying the file in bash in the above lines works perfectly as it should:

2023-05-12-200915_846x926_scrot

See full logs in job #33337

Any idea welcome!

cp node_modules/select2/dist/css/select2.css node_modules/select2/dist/css/select2.min.css 'src/dal_select2/static/vendor/select2/dist/css/*.css'
have no meaning

the folder 'src/dal_select2/static/vendor/select2/dist/css/*.css is undefined / is not a folder

you probably want :
cp node_modules/select2/dist/css/select2.css node_modules/select2/dist/css/select2.min.css src/dal_select2/static/vendor/select2/dist/css/
( if src/dal_select2/static/vendor/select2/dist/css/ is a real existing folder )
but anyway src/dal_select2/static/vendor/select2/dist/css/*.css is not a valid destination folder for the cp command

this invalid cp command seems to be generated by :
"copy-deps": "copyfiles "node_modules/select2/dist/css/.css" "src/dal_select2/static/vendor/select2/dist" -E -u 3"
seems the last parameter of copyfiles should be a valid folder, not containing "
.css"

commented
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,28 +1,35 @@
 name: Clean release
 run-name: ${{ github.actor }} release
-on: push
+on: 
+  push:
+    tags:
+      - '*'
+
 jobs:
   pypi-release:
     runs-on: ubuntu-latest
     container:
       image: yourlabs/python
+      options: --entrypoint /usr/sbin/bash
     steps:
     - name: Check out repository code
       uses: actions/checkout@v3
     - name: debug this crazy environment
       run: |
-        set -x
-        npm install
-        npm run build
+        workdir=$(pwd)
+        chown -R 1000:1000 "$workdir"
+        su - app -c "cd $workdir && npm install && npm run build"
     - name: Update version in setup.py and docs/conf.py
       run: |-x 
         sed -i "s/version=[^,]*,/version='${GITHUB_REF##*/}',/" setup.py
         sed -i "s/release = [^,]*,/release = '${GITHUB_REF##*/}'/" docs/conf.py
-        sed -i 's/version": "[^"]*"/version": "$short"/' package.json
         short=$(echo ${GITHUB_REF##*/} | grep -Eo '[^.]+\.[^.]+')
+        sed -i 's/version": "[^"]*"/version": '\"$short\"'/' package.json
         sed -i "s/version = [^,]*,/version = '${GITHUB_REF##*/}'/" docs/conf.py
     - name: Update changelog
       run: echo -e "$(python changelog.py ${GITHUB_REF##*/})\n$(cat CHANGELOG)" > CHANGELOG
     - uses: stefanzweifel/git-auto-commit-action@v4
     - name: Build python package
       run: python setup.py sdist

Avec ca normalement c'est bon. Mais à cause de short=$(echo ${GITHUB_REF##*/} | grep -Eo '[^.]+\.[^.]+') ca ne peut marcher que avce les tags:

echo 'master' | grep -Eo '[^.]+\.[^.]+' 
echo $?
1

I think we got it to work now, I guess I owe some friends some 🍻 now 🤣

https://github.com/yourlabs/django-autocomplete-light/actions/runs/5066646261/jobs/9096712238