@@ -104,5 +104,5 ENV/ | |||||
104 | *.png |
|
104 | *.png | |
105 | *.pyc |
|
105 | *.pyc | |
106 | schainpy/scripts |
|
106 | schainpy/scripts | |
107 |
|
107 | .vscode | ||
108 | schaingui/node_modules No newline at end of file |
|
108 | schaingui/node_modules |
@@ -32,9 +32,7 class Remote(Thread): | |||||
32 | None |
|
32 | None | |
33 |
|
33 | |||
34 | Written by: |
|
34 | Written by: | |
35 |
|
35 | "Miguel Urco":mailto:miguel.urco@jro.igp.gob.pe Jun. 03, 2015 | ||
36 | "Miguel Urco":mailto:miguel.urco@jro.igp.gob.pe Jun. 03, 2015 |
|
|||
37 |
|
||||
38 | """ |
|
36 | """ | |
39 |
|
37 | |||
40 | server = None |
|
38 | server = None | |
@@ -168,13 +166,13 class Remote(Thread): | |||||
168 | return 0 |
|
166 | return 0 | |
169 |
|
167 | |||
170 | self.mutex.acquire() |
|
168 | self.mutex.acquire() | |
171 | # init = time.time() |
|
169 | # init = time.time() | |
172 | # |
|
170 | # | |
173 | # while(self.bussy): |
|
171 | # while(self.bussy): | |
174 | # sleep(0.1) |
|
172 | # sleep(0.1) | |
175 | # if time.time() - init > 2*self.period: |
|
173 | # if time.time() - init > 2*self.period: | |
176 | # return 0 |
|
174 | # return 0 | |
177 |
|
175 | |||
178 | self.fileList = fileList |
|
176 | self.fileList = fileList | |
179 | self.mutex.release() |
|
177 | self.mutex.release() | |
180 | return 1 |
|
178 | return 1 | |
@@ -198,7 +196,7 class Remote(Thread): | |||||
198 | if self.stopFlag: |
|
196 | if self.stopFlag: | |
199 | break |
|
197 | break | |
200 |
|
198 | |||
201 | # self.bussy = True |
|
199 | # self.bussy = True | |
202 | self.mutex.acquire() |
|
200 | self.mutex.acquire() | |
203 |
|
201 | |||
204 | print "[Remote Server] Opening %s" %self.__server |
|
202 | print "[Remote Server] Opening %s" %self.__server | |
@@ -400,21 +398,21 class SSHClient(Remote): | |||||
400 | def open(self, server, username, password, remotefolder, port=22): |
|
398 | def open(self, server, username, password, remotefolder, port=22): | |
401 |
|
399 | |||
402 | """ |
|
400 | """ | |
403 | This method is used to set SSH parameters and establish a connection to a remote server |
|
401 | This method is used to set SSH parameters and establish a connection to a remote server | |
404 |
|
||||
405 | Inputs: |
|
|||
406 | server - remote server IP Address |
|
|||
407 |
|
402 | |||
408 | username - remote server Username |
|
403 | Inputs: | |
|
404 | server - remote server IP Address | |||
|
405 | ||||
|
406 | username - remote server Username | |||
|
407 | ||||
|
408 | password - remote server password | |||
|
409 | ||||
|
410 | remotefolder - remote server current working directory | |||
409 |
|
411 | |||
410 | password - remote server password |
|
412 | Return: void | |
411 |
|
413 | |||
412 | remotefolder - remote server current working directory |
|
414 | Affects: | |
413 |
|
415 | self.status - in case of error or fail connection this parameter is set to 0 else 1 | ||
414 | Return: void |
|
|||
415 |
|
||||
416 | Affects: |
|
|||
417 | self.status - in case of error or fail connection this parameter is set to 0 else 1 |
|
|||
418 |
|
416 | |||
419 | """ |
|
417 | """ | |
420 | import socket |
|
418 | import socket | |
@@ -440,7 +438,7 class SSHClient(Remote): | |||||
440 | try: |
|
438 | try: | |
441 | sshClientObj.connect(server, username=username, password=password, port=port) |
|
439 | sshClientObj.connect(server, username=username, password=password, port=port) | |
442 | except paramiko.AuthenticationException, e: |
|
440 | except paramiko.AuthenticationException, e: | |
443 | # print "SSH username or password are incorrect: %s" |
|
441 | # print "SSH username or password are incorrect: %s" | |
444 | print "[SSH Server]:", e |
|
442 | print "[SSH Server]:", e | |
445 | return 0 |
|
443 | return 0 | |
446 | except SSHException, e: |
|
444 | except SSHException, e: | |
@@ -474,7 +472,7 class SSHClient(Remote): | |||||
474 |
|
472 | |||
475 | def close(self): |
|
473 | def close(self): | |
476 | """ |
|
474 | """ | |
477 | Close connection to remote server |
|
475 | Close connection to remote server | |
478 | """ |
|
476 | """ | |
479 | if not self.status: |
|
477 | if not self.status: | |
480 | return 0 |
|
478 | return 0 | |
@@ -484,13 +482,13 class SSHClient(Remote): | |||||
484 |
|
482 | |||
485 | def __execute(self, command): |
|
483 | def __execute(self, command): | |
486 | """ |
|
484 | """ | |
487 | __execute a command on remote server |
|
485 | __execute a command on remote server | |
488 |
|
486 | |||
489 | Input: |
|
487 | Input: | |
490 | command - Exmaple 'ls -l' |
|
488 | command - Exmaple 'ls -l' | |
491 |
|
489 | |||
492 | Return: |
|
490 | Return: | |
493 | 0 in error case else 1 |
|
491 | 0 in error case else 1 | |
494 | """ |
|
492 | """ | |
495 | if not self.status: |
|
493 | if not self.status: | |
496 | return 0 |
|
494 | return 0 | |
@@ -509,13 +507,13 class SSHClient(Remote): | |||||
509 |
|
507 | |||
510 | def mkdir(self, remotefolder): |
|
508 | def mkdir(self, remotefolder): | |
511 | """ |
|
509 | """ | |
512 | mkdir is used to make a new directory in remote server |
|
510 | mkdir is used to make a new directory in remote server | |
513 |
|
511 | |||
514 | Input: |
|
512 | Input: | |
515 | remotefolder - directory name |
|
513 | remotefolder - directory name | |
516 |
|
514 | |||
517 | Return: |
|
515 | Return: | |
518 | 0 in error case else 1 |
|
516 | 0 in error case else 1 | |
519 | """ |
|
517 | """ | |
520 |
|
518 | |||
521 | command = 'mkdir %s' %remotefolder |
|
519 | command = 'mkdir %s' %remotefolder | |
@@ -530,16 +528,16 class SSHClient(Remote): | |||||
530 |
|
528 | |||
531 | def cd(self, remotefolder): |
|
529 | def cd(self, remotefolder): | |
532 | """ |
|
530 | """ | |
533 | cd is used to change remote working directory on server |
|
531 | cd is used to change remote working directory on server | |
534 |
|
||||
535 | Input: |
|
|||
536 | remotefolder - current working directory |
|
|||
537 |
|
532 | |||
538 | Affects: |
|
533 | Input: | |
539 | self.remotefolder |
|
534 | remotefolder - current working directory | |
540 |
|
535 | |||
541 |
|
|
536 | Affects: | |
542 | 0 in case of error else 1 |
|
537 | self.remotefolder | |
|
538 | ||||
|
539 | Return: | |||
|
540 | 0 in case of error else 1 | |||
543 | """ |
|
541 | """ | |
544 | if not self.status: |
|
542 | if not self.status: | |
545 | return 0 |
|
543 | return 0 | |
@@ -582,9 +580,7 class SendToServer(ProcessingUnit): | |||||
582 | ProcessingUnit.__init__(self) |
|
580 | ProcessingUnit.__init__(self) | |
583 |
|
581 | |||
584 | self.isConfig = False |
|
582 | self.isConfig = False | |
585 | self.clientObj = None |
|
583 | self.clientObj = None | |
586 |
|
||||
587 |
|
||||
588 |
|
584 | |||
589 | def setup(self, server, username, password, remotefolder, localfolder, ext='.png', period=60, protocol='ftp', **kwargs): |
|
585 | def setup(self, server, username, password, remotefolder, localfolder, ext='.png', period=60, protocol='ftp', **kwargs): | |
590 |
|
586 | |||
@@ -710,7 +706,7 class FTP(object): | |||||
710 | self.ftp = ftplib.FTP(self.server) |
|
706 | self.ftp = ftplib.FTP(self.server) | |
711 | self.ftp.login(self.username,self.password) |
|
707 | self.ftp.login(self.username,self.password) | |
712 | self.ftp.cwd(self.remotefolder) |
|
708 | self.ftp.cwd(self.remotefolder) | |
713 | # print 'Connect to FTP Server: Successfully' |
|
709 | # print 'Connect to FTP Server: Successfully' | |
714 |
|
710 | |||
715 | except ftplib.all_errors: |
|
711 | except ftplib.all_errors: | |
716 | print 'Error FTP Service' |
|
712 | print 'Error FTP Service' | |
@@ -742,7 +738,7 class FTP(object): | |||||
742 | name, ext = os.path.splitext(f) |
|
738 | name, ext = os.path.splitext(f) | |
743 | if ext != '': |
|
739 | if ext != '': | |
744 | self.fileList.append(f) |
|
740 | self.fileList.append(f) | |
745 | # print 'filename: %s - size: %d'%(f,self.ftp.size(f)) |
|
741 | # print 'filename: %s - size: %d'%(f,self.ftp.size(f)) | |
746 |
|
742 | |||
747 | def parmsByDefault(self): |
|
743 | def parmsByDefault(self): | |
748 | server = 'jro-app.igp.gob.pe' |
|
744 | server = 'jro-app.igp.gob.pe' |
@@ -3,10 +3,19 Created on Jul 16, 2014 | |||||
3 |
|
3 | |||
4 | @author: Miguel Urco |
|
4 | @author: Miguel Urco | |
5 | ''' |
|
5 | ''' | |
6 | import numpy |
|
|||
7 | from setuptools import setup, Extension |
|
6 | from setuptools import setup, Extension | |
|
7 | from setuptools.command.build_ext import build_ext as _build_ext | |||
8 | from schainpy import __version__ |
|
8 | from schainpy import __version__ | |
9 |
|
9 | |||
|
10 | class build_ext(_build_ext): | |||
|
11 | def finalize_options(self): | |||
|
12 | _build_ext.finalize_options(self) | |||
|
13 | # Prevent numpy from thinking it is still in its setup process: | |||
|
14 | __builtins__.__NUMPY_SETUP__ = False | |||
|
15 | import numpy | |||
|
16 | self.include_dirs.append(numpy.get_include()) | |||
|
17 | ||||
|
18 | ||||
10 | setup(name="schainpy", |
|
19 | setup(name="schainpy", | |
11 | version=__version__, |
|
20 | version=__version__, | |
12 | description="Python tools to read, write and process Jicamarca data", |
|
21 | description="Python tools to read, write and process Jicamarca data", | |
@@ -34,14 +43,16 setup(name="schainpy", | |||||
34 | include_package_data=False, |
|
43 | include_package_data=False, | |
35 | scripts =['schainpy/gui/schainGUI', |
|
44 | scripts =['schainpy/gui/schainGUI', | |
36 | 'schainpy/scripts/schain'], |
|
45 | 'schainpy/scripts/schain'], | |
37 | ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"], include_dirs=[numpy.get_include()])], |
|
46 | ext_modules=[ | |
|
47 | Extension("cSchain", ["schainpy/model/proc/extensions.c"] | |||
|
48 | )], | |||
|
49 | cmdclass={'build_ext':build_ext}, | |||
|
50 | setup_requires=["numpy >= 1.11.2"], | |||
38 | install_requires=[ |
|
51 | install_requires=[ | |
39 | "scipy >= 0.14.0", |
|
52 | "scipy >= 0.14.0", | |
40 | "h5py >= 2.2.1", |
|
53 | "h5py >= 2.2.1", | |
41 | "matplotlib >= 1.4.2", |
|
54 | "matplotlib >= 1.4.2", | |
42 | "pyfits >= 3.4", |
|
55 | "pyfits >= 3.4", | |
43 | "numpy >= 1.11.2", |
|
|||
44 | "paramiko >= 2.1.2", |
|
|||
45 | "paho-mqtt >= 1.2", |
|
56 | "paho-mqtt >= 1.2", | |
46 | "zmq", |
|
57 | "zmq", | |
47 | ], |
|
58 | ], |
General Comments 0
You need to be logged in to leave comments.
Login now