Do not make folders in setup.py
@@ -30,23 +30,6 @@ METADATA = os.path.join(SETUP_DIRNAME, 'plenum', '__metadata__.py')
# Load the metadata using exec() so we don't trigger an import of ioflo.__init__
exec(compile(open(METADATA).read(), METADATA, 'exec'))
-BASE_DIR = os.path.join(os.path.expanduser("~"), ".plenum")
-LOG_DIR = os.path.join(BASE_DIR, "log")
-CONFIG_FILE = os.path.join(BASE_DIR, "plenum_config.py")
-
-for path in [BASE_DIR, LOG_DIR]:
- if not os.path.exists(path):
- os.makedirs(path)
-
-if not os.path.exists(CONFIG_FILE):
- with open(CONFIG_FILE, 'w') as f:
- msg = "# Here you can create config entries according to your " \
- "needs.\n " \
- "# For help, refer config.py in the plenum package.\n " \
- "# Any entry you add here would override that from config " \
- "example\n"
- f.write(msg)
-
setup(
name='indy-plenum-dev',
version=__version__,
@@ -87,44 +70,3 @@ setup(
'scripts/log_stats',
'scripts/init_bls_keys']
)
-
-if not os.path.exists(CONFIG_FILE):
- with open(CONFIG_FILE, 'w') as f:
- msg = "# Here you can create config entries according to your " \
- "needs.\n " \
- "# For help, refer config.py in the plenum module.\n " \
- "# Any entry you add here would override that from config " \
- "example\n"
- f.write(msg)
-
-
-# TODO: This code should not be copied here.
-import getpass
-import os
-import shutil
-import sys
-
-
-def getLoggedInUser():
- if sys.platform == 'wind32':
- return getpass.getuser()
- else:
- if 'SUDO_USER' in os.environ:
- return os.environ['SUDO_USER']
- else:
- return getpass.getuser()
-
-
-def changeOwnerAndGrpToLoggedInUser(directory, raiseEx=False):
- loggedInUser = getLoggedInUser()
- try:
- shutil.chown(directory, loggedInUser, loggedInUser)
- except Exception as e:
- if raiseEx:
- raise e
- else:
- pass
-
-
-changeOwnerAndGrpToLoggedInUser(BASE_DIR)
-changeOwnerAndGrpToLoggedInUser(LOG_DIR)
