From cfaa3fd99bda697d10cb8e86075e4dbeb5da10c4 2017-09-07 13:46:36 From: José Chávez Date: 2017-09-07 13:46:36 Subject: [PATCH] setup actualizado para no necesitar numpy previamente --- diff --git a/.gitignore b/.gitignore index 477070f..c6df47a 100644 --- a/.gitignore +++ b/.gitignore @@ -104,5 +104,5 @@ ENV/ *.png *.pyc schainpy/scripts - +.vscode schaingui/node_modules \ No newline at end of file diff --git a/schainpy/model/utils/jroutils_ftp.py b/schainpy/model/utils/jroutils_ftp.py index 3e7e2aa..3a2a77f 100644 --- a/schainpy/model/utils/jroutils_ftp.py +++ b/schainpy/model/utils/jroutils_ftp.py @@ -32,9 +32,7 @@ class Remote(Thread): None Written by: - - "Miguel Urco":mailto:miguel.urco@jro.igp.gob.pe Jun. 03, 2015 - + "Miguel Urco":mailto:miguel.urco@jro.igp.gob.pe Jun. 03, 2015 """ server = None @@ -168,13 +166,13 @@ class Remote(Thread): return 0 self.mutex.acquire() -# init = time.time() -# -# while(self.bussy): -# sleep(0.1) -# if time.time() - init > 2*self.period: -# return 0 - + # init = time.time() + # + # while(self.bussy): + # sleep(0.1) + # if time.time() - init > 2*self.period: + # return 0 + self.fileList = fileList self.mutex.release() return 1 @@ -198,7 +196,7 @@ class Remote(Thread): if self.stopFlag: break -# self.bussy = True + # self.bussy = True self.mutex.acquire() print "[Remote Server] Opening %s" %self.__server @@ -400,21 +398,21 @@ class SSHClient(Remote): def open(self, server, username, password, remotefolder, port=22): """ - This method is used to set SSH parameters and establish a connection to a remote server - - Inputs: - server - remote server IP Address + This method is used to set SSH parameters and establish a connection to a remote server - username - remote server Username + Inputs: + server - remote server IP Address + + username - remote server Username + + password - remote server password + + remotefolder - remote server current working directory - password - remote server password + Return: void - remotefolder - remote server current working directory - - Return: void - - Affects: - self.status - in case of error or fail connection this parameter is set to 0 else 1 + Affects: + self.status - in case of error or fail connection this parameter is set to 0 else 1 """ import socket @@ -440,7 +438,7 @@ class SSHClient(Remote): try: sshClientObj.connect(server, username=username, password=password, port=port) except paramiko.AuthenticationException, e: -# print "SSH username or password are incorrect: %s" + # print "SSH username or password are incorrect: %s" print "[SSH Server]:", e return 0 except SSHException, e: @@ -474,7 +472,7 @@ class SSHClient(Remote): def close(self): """ - Close connection to remote server + Close connection to remote server """ if not self.status: return 0 @@ -484,13 +482,13 @@ class SSHClient(Remote): def __execute(self, command): """ - __execute a command on remote server - - Input: - command - Exmaple 'ls -l' - - Return: - 0 in error case else 1 + __execute a command on remote server + + Input: + command - Exmaple 'ls -l' + + Return: + 0 in error case else 1 """ if not self.status: return 0 @@ -509,13 +507,13 @@ class SSHClient(Remote): def mkdir(self, remotefolder): """ - mkdir is used to make a new directory in remote server - - Input: - remotefolder - directory name - - Return: - 0 in error case else 1 + mkdir is used to make a new directory in remote server + + Input: + remotefolder - directory name + + Return: + 0 in error case else 1 """ command = 'mkdir %s' %remotefolder @@ -530,16 +528,16 @@ class SSHClient(Remote): def cd(self, remotefolder): """ - cd is used to change remote working directory on server - - Input: - remotefolder - current working directory + cd is used to change remote working directory on server - Affects: - self.remotefolder - - Return: - 0 in case of error else 1 + Input: + remotefolder - current working directory + + Affects: + self.remotefolder + + Return: + 0 in case of error else 1 """ if not self.status: return 0 @@ -582,9 +580,7 @@ class SendToServer(ProcessingUnit): ProcessingUnit.__init__(self) self.isConfig = False - self.clientObj = None - - + self.clientObj = None def setup(self, server, username, password, remotefolder, localfolder, ext='.png', period=60, protocol='ftp', **kwargs): @@ -710,7 +706,7 @@ class FTP(object): self.ftp = ftplib.FTP(self.server) self.ftp.login(self.username,self.password) self.ftp.cwd(self.remotefolder) -# print 'Connect to FTP Server: Successfully' + # print 'Connect to FTP Server: Successfully' except ftplib.all_errors: print 'Error FTP Service' @@ -742,7 +738,7 @@ class FTP(object): name, ext = os.path.splitext(f) if ext != '': self.fileList.append(f) -# print 'filename: %s - size: %d'%(f,self.ftp.size(f)) + # print 'filename: %s - size: %d'%(f,self.ftp.size(f)) def parmsByDefault(self): server = 'jro-app.igp.gob.pe' diff --git a/setup.py b/setup.py index d4eba9c..7af7198 100644 --- a/setup.py +++ b/setup.py @@ -3,10 +3,19 @@ Created on Jul 16, 2014 @author: Miguel Urco ''' -import numpy from setuptools import setup, Extension +from setuptools.command.build_ext import build_ext as _build_ext from schainpy import __version__ +class build_ext(_build_ext): + def finalize_options(self): + _build_ext.finalize_options(self) + # Prevent numpy from thinking it is still in its setup process: + __builtins__.__NUMPY_SETUP__ = False + import numpy + self.include_dirs.append(numpy.get_include()) + + setup(name="schainpy", version=__version__, description="Python tools to read, write and process Jicamarca data", @@ -34,14 +43,16 @@ setup(name="schainpy", include_package_data=False, scripts =['schainpy/gui/schainGUI', 'schainpy/scripts/schain'], - ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"], include_dirs=[numpy.get_include()])], + ext_modules=[ + Extension("cSchain", ["schainpy/model/proc/extensions.c"] + )], + cmdclass={'build_ext':build_ext}, + setup_requires=["numpy >= 1.11.2"], install_requires=[ "scipy >= 0.14.0", "h5py >= 2.2.1", "matplotlib >= 1.4.2", "pyfits >= 3.4", - "numpy >= 1.11.2", - "paramiko >= 2.1.2", "paho-mqtt >= 1.2", "zmq", ],