Please before flagging as duplicate, I have tried a bunch of solutions including one here but no luck
I have created a simple tool to do some tasks and was able to package it successfully.
When trying to install it, I get the desired effect when I use python setup.py install
but pip install package_name
just installs the package but no post installation script.
Here is part of my code;
setup.py
from distutils import setup
from app.scripts import *
setup(
#Application name
name = "my-app-name",
version = "my-app-version",
author = "my-name",
author_email = "my-email",
packages = ['app'],
include_package_data = True,
license = 'MIT',
url = "https://my-url",
description = "description",
install_requires = ["flake8"],
cmdclass = {
"install":Post_install
}
)
scripts.py
from distutils.command.install import install
import os
class Post_install(install):
@staticmethod
def func():
return True
def run(self):
install.run(self)
#Pre install actions
if Post_install.func():
print("Bingo")
else:
print("Failed")
Thanks :)
PS I run pip install
after uploading the package.