HenriWahl / dhcpy6d

MAC address aware DHCPv6 server written in Python
https://dhcpy6d.de
GNU General Public License v2.0
94 stars 27 forks source link

setup.py: make installation with pip more pythonic #34

Closed miri64 closed 3 years ago

miri64 commented 3 years ago

This allows for dhcpy6d to be installed as user or within a virtualenv without creating foreign files in the users or virtualenv's library directory.

I tested the process with for installing

to a virtualenv and ```console $ virtualenv -p python3 env created virtual environment CPython3.8.6.final.0-64 in 258ms creator CPython3Posix(dest=/home/mlenders/Repositories/RIOT-OS/dhcpy6d/env, clear=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mlenders/.local/share/virtualenv) added seed packages: dhcpy6d==1.0.2, distro==1.5.0, dnspython==2.0.0, pip==20.2.4, setuptools==50.3.2, wheel==0.35.1 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator $ . env/bin/activate 0 0 $ pip install . Processing /home/mlenders/Repositories/RIOT-OS/dhcpy6d Requirement already satisfied: distro in ./env/lib/python3.8/site-packages (from dhcpy6d==1.0.2) (1.5.0) Requirement already satisfied: dnspython in ./env/lib/python3.8/site-packages (from dhcpy6d==1.0.2) (2.0.0) Building wheels for collected packages: dhcpy6d Building wheel for dhcpy6d (setup.py) ... done Created wheel for dhcpy6d: filename=dhcpy6d-1.0.2-py3-none-any.whl size=115236 sha256=814b5d3b1f787a60e85a8f90bd97ac3d0cf5a26683fd7ed895684cba0e6af2b8 Stored in directory: /tmp/pip-ephem-wheel-cache-mafzqe1v/wheels/e3/85/10/8615455059a4cca7116f80180e75455e69492f2ad57a1a24f7 Successfully built dhcpy6d Installing collected packages: dhcpy6d Attempting uninstall: dhcpy6d Found existing installation: dhcpy6d 1.0.2 Uninstalling dhcpy6d-1.0.2: Successfully uninstalled dhcpy6d-1.0.2 Successfully installed dhcpy6d-1.0.2 $ dhcpy6d --help option --help not recognized dhcpy6d - DHCPv6 server Usage: dhcpy6d --config [--user ] [--group ] [--duid ] [--prefix ] [--really-do-it |] dhcpy6d --message '' dhcpy6d --generate-duid See manpage dhcpy6d(8) for details. ```
on Debian. ``` $ uname -a Linux buster 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64 GNU/Linux $ ./build.sh […] $ sudo apt-get install python3-distro python3-dnspython […] $ sudo dpkg -i ../dhcpy6d_1.0.2-1_all.deb […] $ ls /usr/sbin/dhcpy6d /usr/sbin/dhcpy6d $ sudo ls /var/lib/dhcpy6d/ volatile.sqlite [...] ```

I also tried on CentOS 7, and the build was successful, but I was unable to install the RPM, due to missing dependencies:

[vagrant@localhost dhcpy6d]$ sudo rpm -i ../dhcpy6d.1839/RPMS/noarch/dhcpy6d-1.0.2-1.el7.noarch.rpm 
error: Failed dependencies:
    python3-PyMySQL is needed by dhcpy6d-1.0.2-1.el7.noarch
    python3-distro is needed by dhcpy6d-1.0.2-1.el7.noarch
    python3-dns is needed by dhcpy6d-1.0.2-1.el7.noarch
[vagrant@localhost dhcpy6d]$ sudo yum install python3-PyMySQL python3-distro python3-dns
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.schlundtech.de
 * extras: mirror.23media.com
 * updates: ftp.fau.de
No package python3-PyMySQL available.
No package python3-distro available.
No package python3-dns available.
Error: Nothing to do

(I am not a regular CentOS user, so I might have done something wrong)

HenriWahl commented 3 years ago

Will only run on CentOS 8, but it is OK, I tested it and it installs. Thanks!

miri64 commented 3 years ago

Thanks for testing!

HenriWahl commented 3 years ago

Sorry I had to revert the pull request because it broke build of .deb and .rpm packages. Might need another look?

miri64 commented 3 years ago

:disappointed: okay, I will have another look soon. At the moment I am a bit swamped in other work, but I keep it on my TODO list.

HenriWahl commented 3 years ago

:disappointed: okay, I will have another look soon. At the moment I am a bit swamped in other work, but I keep it on my TODO list.

When I find the time I will check it too but I needed a working RPM urgently with another fix I added.