dogecoin / ltc-scrypt

Python3 wrapper for Litecoin-Scrypt
GNU Affero General Public License v3.0
8 stars 6 forks source link

Build the module differently #10

Open patricklodder opened 2 years ago

patricklodder commented 2 years ago

Originally posted by @xanimo in https://github.com/dogecoin/ltc-scrypt/pull/9#pullrequestreview-1078062721

Also a small nit that can be addressed in the future is to address the deprecation warnings regarding setup.py install as shown here:

$ CC=clang python setup.py install --user
running install
/home/bluezr/.local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/bluezr/.local/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/bluezr/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/home/bluezr/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
...

This can be resolved by running python -m pip install .:

bluezr@x:/source/repos/ltc-scrypt$ CC=clang python -m pip install .
Defaulting to user installation because normal site-packages is not writeable
Processing /source/repos/ltc-scrypt
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: ltc-scrypt
  Building wheel for ltc-scrypt (setup.py) ... done
  Created wheel for ltc-scrypt: filename=ltc_scrypt-1.0-cp310-cp310-linux_x86_64.whl size=36781 sha256=0bceca8e9adbf6d2df42c6d9ac0e48a14036b00f1c5d6a61a9df77345dae241d
  Stored in directory: /home/bluezr/.cache/pip/wheels/ef/29/20/2b1706323ba8e21079924937b665d6b9c847ee8e478587a526
Successfully built ltc-scrypt
Installing collected packages: ltc-scrypt
  Attempting uninstall: ltc-scrypt
    Found existing installation: ltc-scrypt 1.0
    Uninstalling ltc-scrypt-1.0:
      Successfully uninstalled ltc-scrypt-1.0
Successfully installed ltc-scrypt-1.0
bluezr@x:/source/repos/ltc-scrypt$ CC=clang python test.py
test successful.
patricklodder commented 2 years ago

The only question mark I have with this is:

Defaulting to user installation because normal site-packages is not writeable

can we make that explicit in the same way as we're calling setup.py --user?

wakiyamap commented 2 years ago

Now I think it's better to use setuptools instead of distutils.core. https://github.com/dogecoin/ltc-scrypt/blob/cab9cb027636dcca4112f2df607598aa3f502263/setup.py#L16

from setuptools import setup, Extension

patricklodder commented 2 years ago

Now I think it's better to use setuptools instead of distutils.core.

Thanks! This is do-able once we no longer need to support python 3.6 - currently we depend on that with Dogecoin Core because we cannot build 1.14 on anything higher than bionic. Once we've solved that problem there, we can move this to setuptools and save ourselves the dependency.

In the interim we could do something like this: https://github.com/patricklodder/ltc-scrypt/commit/00109437c086ebb005f837621b96665ae613bfe2