Any python function to get “data_files” root directory?

By default, when installing a package as root, relative directory names in the data_files list are are resolved against either the value of sys.prefix (for pure-python libraries) or sys.exec_prefix (for libraries with a compiled extension), so you can retrieve your files based on that. Qouting from the distutils documentation: If directory is a relative path, … Read more

pip install PyQt IOError

That’s because that file has a configure.py not a setup.py. configure.py generate a make file that you use to build pyqt against the qt lib you choose by passing –qmake option to configure.py, it has different options too. I suggest filing a bug with the pip maintainer.

What does the `platforms` argument to `setup()` in `setup.py` do?

platforms is an argument the setuptools package inherits from distutils; see the Additional meta-data section in the distutils documentation: Meta-Data: platforms Description: a list of platforms Value: list of strings So, yes, using a list is the correct syntax. The field just provides metadata; what platforms does the package target. Use this to communicate to … Read more

Specifying command line scripts in pyproject.toml

Update July 2022: if your TOML file uses setuptools as its build system, setuptools will happily create and install a command-line script. For example, my pyproject.toml file starts like this: [build-system] requires = [“setuptools>=61.0”] build-backend = “setuptools.build_meta” Extend your pyproject.toml file with an entry like this, naming the package, module and entry-point function names: [project.scripts] … Read more

Using setup.py to install python project as a systemd service

You get an ImportError, because the module in question is not in sys.path or not accessible, because of some file system permissions. Here’s a script to check file system permissions of a given distribution, group and name. chk_perm.py from pkg_resources import get_distribution import os import sys dist, group, name = sys.argv[1:] dist = get_distribution(dist) location … Read more

Python setup.py: How to get find_packages() to identify packages in subdirectories

This is like using the src-layout for the “foo” and “bar” packages, but the flat layout for “baz”. It’s possible, but requires some custom configuration in the setup.py. Setuptools’ find_packages supports a “where” keyword (docs), you can use that. setup( … packages=( find_packages() + find_packages(where=”./bar-pack”) + find_packages(where=”./foo-pack”) ), … ) Since find_packages returns a plain … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)