piku / piku

The tiniest PaaS you've ever seen. Piku allows you to do git push deployments to your own servers.
http://piku.github.io
MIT License
5.81k stars 134 forks source link

Python3.12(on Ubuntu 24.04) SyntaxWarning issues #346

Closed birlorg closed 4 months ago

birlorg commented 5 months ago

I'm brand new to piku, and setting it up on on Ubuntu 24.04 LTS, which runs python 3.12 now(Python 3.12.3).

In Python3.12 deprecated escape sequence issues have been upgraded to SyntaxWarning

/home/piku/piku.py:110: SyntaxWarning: invalid escape sequence '\.'
  NGINX_COMMON_FRAGMENT = """
/home/piku/piku.py:216: SyntaxWarning: invalid escape sequence '\*'
  CRON_REGEXP = "^((?:(?:\*\/)?\d+)|\*) ((?:(?:\*\/)?\d+)|\*) ((?:(?:\*\/)?\d+)|\*) ((?:(?:\*\/)?\d+)|\*) ((?:(?:\*\/)?\d+)|\*) (.*)$"
/home/piku/piku.py:852: SyntaxWarning: invalid escape sequence '\.'
  env['PIKU_INTERNAL_NGINX_BLOCK_GIT'] = "" if env.get('NGINX_ALLOW_GIT_FOLDERS') else "location ~ /\.git { deny all; }"

It's been deprecated since Python 3.6:

A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases. (Contributed by Emanuel Barry in bpo-27364.)

rcarmo commented 5 months ago

Thanks. Those should be just a matter of adding the 'r' prefix, but I will test them on a 24.04 machine.

birlorg commented 5 months ago

I agree, it seems to work for me with r prefix, but I don't really know how piku is supposed to work, so maybe I broke stuff I don't even know about.

rcarmo commented 5 months ago

It’s not broken-the ‘r’ prefix denotes regular expression rules apply to those string blocks.

rcarmo commented 5 months ago

Closed via #704372c.

abdulbasetbasher commented 5 months ago
ssh piku@xxxxxx

/home/piku/piku.py:977: SyntaxWarning: invalid escape sequence '\.'
  nginx_config_test = str(check_output("nginx -t 2>&1 | grep -E '{}\.conf:[0-9]+$'".format(app), env=environ, shell=True))

i think this related to same bug on Python3.12