microsoft / playwright-python

Python version of the Playwright testing and automation library.
https://playwright.dev/python/
Apache License 2.0
11.75k stars 894 forks source link

[BUG] Missing "driver" folder when installed by setup.py #1713

Closed D3vil0p3r closed 1 year ago

D3vil0p3r commented 1 year ago

Context:

Describe the bug

Hello, I'm working on Arch Linux and I'm creating a PKGBUILD for a package of playwright-python project. The PKGBUILD has the following structure:

pkgname=python-playwright
_pkgname=playwright-python
pkgver=v1.29.0.r4.g2d0df8e
pkgrel=1
pkgdesc='Python version of the Playwright testing and automation library.'
arch=('any')
url='https://github.com/Microsoft/playwright-python'
license=('Apache')
depends=('mypy' 'python' 'python-auditwheel' 'python-autobahn' 'python-black' 'python-flake8' 'python-flaky' 'python-greenlet' 'python-objgraph' 'python-pillow' 'python-pixelmatch' 'python-pre-commit' 'python-pyee' 'python-pyopenssl' 'python-pytest' 'python-pytest-asyncio' 'python-pytest-cov' 'python-pytest-repeat' 'python-pytest-timeout' 'python-pytest-xdist' 'python-requests' 'python-service-identity' 'python-twine' 'python-twisted' 'python-types-pyopenssl')
makedepends=('python-setuptools' 'python-wheel')
options=(!emptydirs)
source=("git+https://github.com/Microsoft/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$_pkgname"

  python setup.py build
}

package() {
  cd "$_pkgname"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

(Note that some dependencies are not in Arch repos, I created them, but the mandatory packages should be)

I noted that, when I install playwright by setup.py (as shown in PKGBUILD code), in playwright python lib folder I have the following folders/files:

$ ls -la /usr/lib/python3.10/site-packages/playwright/

drwxr-xr-x root root 158 B  Fri Jan  6 19:50:57 2023  ./
drwxr-xr-x root root  19 KB Fri Jan  6 19:50:57 2023  ../
.rw-r--r-- root root 805 B  Fri Jan  6 19:50:32 2023  __init__.py
.rw-r--r-- root root 964 B  Fri Jan  6 19:50:32 2023  __main__.py
drwxr-xr-x root root 344 B  Fri Jan  6 19:50:57 2023  __pycache__/
drwxr-xr-x root root 1.3 KB Fri Jan  6 19:50:57 2023  _impl/
.rw-r--r-- root root  34 B  Fri Jan  6 19:50:32 2023  _repo_version.py
drwxr-xr-x root root 108 B  Fri Jan  6 19:50:57 2023  async_api/
.rw-r--r-- root root   0 B  Fri Jan  6 19:50:32 2023  py.typed
drwxr-xr-x root root 164 B  Fri Jan  6 19:50:57 2023  sync_api/

and in /usr/lib/python3.10/site-packages/playwright-1.29.0.post4+g2d0df8e-py3.10.egg/playwright/ I have:

$ ls -la /usr/lib/python3.10/site-packages/playwright-1.29.0.post4+g2d0df8e-py3.10.egg/playwright/

drwxr-xr-x root root 158 B  Fri Jan  6 19:41:03 2023  ./
drwxr-xr-x root root  36 B  Fri Jan  6 19:41:03 2023  ../
.rw-r--r-- root root 805 B  Fri Jan  6 19:41:03 2023  __init__.py
.rw-r--r-- root root 964 B  Fri Jan  6 19:41:03 2023  __main__.py
drwxr-xr-x root root 154 B  Fri Jan  6 19:41:03 2023  __pycache__/
drwxr-xr-x root root 1.3 KB Fri Jan  6 19:41:03 2023  _impl/
.rw-r--r-- root root  34 B  Fri Jan  6 19:41:03 2023  _repo_version.py
drwxr-xr-x root root 108 B  Fri Jan  6 19:41:03 2023  async_api/
.rw-r--r-- root root   0 B  Fri Jan  6 19:41:03 2023  py.typed
drwxr-xr-x root root 164 B  Fri Jan  6 19:41:03 2023  sync_api/

Now, if I uninstall it (and I must be sure that those 2 folders are deleted) and I install playwright by pip (i.e., by sudo pip install playwright (used sudo only for this test. I get the same result also with no sudo)), in these folders I get:

$ ls -la /usr/lib/python3.10/site-packages/playwright

drwxr-xr-x root root 170 B  Fri Jan  6 19:57:21 2023  ./
drwxr-xr-x root root  19 KB Fri Jan  6 19:57:21 2023  ../
.rw-r--r-- root root 805 B  Fri Jan  6 19:57:21 2023  __init__.py
.rw-r--r-- root root 964 B  Fri Jan  6 19:57:21 2023  __main__.py
drwxr-xr-x root root 154 B  Fri Jan  6 19:57:21 2023  __pycache__/
drwxr-xr-x root root 1.3 KB Fri Jan  6 19:57:21 2023  _impl/
.rw-r--r-- root root  19 B  Fri Jan  6 19:57:21 2023  _repo_version.py
drwxr-xr-x root root 108 B  Fri Jan  6 19:57:21 2023  async_api/
drwxr-xr-x root root  80 B  Fri Jan  6 19:57:21 2023  driver/
.rw-r--r-- root root   0 B  Fri Jan  6 19:57:21 2023  py.typed
drwxr-xr-x root root 164 B  Fri Jan  6 19:57:21 2023  sync_api/

So, in this case I have driver folder that contains the playwright.sh called by /usr/bin/playwright.

Why when I use setup.py for building and installing, I don't get the driver folder and its content?

mxschmitt commented 1 year ago

PKGBUILD is about Arch Linux, and Playwright does not work there, since browsers are not compiled for it. So I think this effort would not be worth it or what are you planning to do?

D3vil0p3r commented 1 year ago

I would like to install it because some tool I need to use uses Playwright as dependency.

mxschmitt commented 1 year ago

Yes but its not only about the Playwright python package, the browsers like WebKit would then just not work. (the dependencies are linked to different versions)

So closing for now and folding into https://github.com/microsoft/playwright/issues/8100 since it would require a lot of upstream browser work.