Module setup
[frames] | no frames]

Source Code for Module setup

  1  #!/usr/bin/env python 
  2   
  3  # Rekall 
  4  # Copyright 2013 Google Inc. All Rights Reserved. 
  5  # 
  6  # Authors: 
  7  # Michael Cohen <scudette@gmail.com> 
  8  # 
  9  # This program is free software; you can redistribute it and/or modify 
 10  # it under the terms of the GNU General Public License as published by 
 11  # the Free Software Foundation; either version 2 of the License, or (at 
 12  # your option) any later version. 
 13  # 
 14  # This program is distributed in the hope that it will be useful, but 
 15  # WITHOUT ANY WARRANTY; without even the implied warranty of 
 16  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
 17  # General Public License for more details. 
 18  # 
 19  # You should have received a copy of the GNU General Public License 
 20  # along with this program; if not, write to the Free Software 
 21  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 22  # 
 23  """Installation and deployment script.""" 
 24  __author__ = "Michael Cohen <scudette@gmail.com>" 
 25  import os 
 26  import subprocess 
 27  import setuptools 
 28   
 29  from setuptools import find_packages, setup, Command 
 30   
 31  rekall_description = "Rekall Memory Forensic Framework" 
 32   
 33  current_directory = os.path.dirname(__file__) 
 34   
 35  ENV = {"__file__": __file__} 
 36  exec open("rekall/_version.py").read() in ENV 
 37  VERSION = ENV["get_versions"]() 
 38   
 39   
40 -def find_data_files(source):
41 result = [] 42 for directory, _, files in os.walk(source): 43 files = [os.path.join(directory, x) for x in files] 44 result.append((directory, files)) 45 46 return result
47 48 49 # These versions are fixed to the exact tested configuration. Prior to release, 50 # please use "setup.py pip_upgrade" to test with the latest version. This 51 # approach ensures that any Rekall version will always work as tested - even 52 # when external packages are upgraded in an incompatible way. 53 install_requires = [ 54 "artifacts == 20160114", 55 "pyaff4 >= 0.24, < 0.30", 56 "PyYAML == 3.11", 57 "acora == 2.0", 58 "arrow == 0.7.0", 59 "rekall-efilter == 1.5.2", 60 "intervaltree == 2.1.0", 61 "pycrypto == 2.6.1", 62 "pyelftools == 0.24", 63 "pyparsing==2.1.5", 64 "pytz == 2016.4", 65 "psutil >= 5.0, < 6.0", 66 "rekall-capstone == 3.0.4.post2", 67 "rekall-yara == 3.4.0.1", 68 "pytsk3 == 20160721", 69 "ipaddr==2.1.11", 70 71 # Version 2.5.0 is broken with pyinstaller. 72 # https://github.com/pyinstaller/pyinstaller/issues/1848 73 "python-dateutil == 2.5.3", 74 75 "rekall-lib >= 1.7.0rc1, < 1.8", 76 ] 77 78 if "VIRTUAL_ENV" not in os.environ: 79 print "*****************************************************" 80 print " WARNING: You are not installing Rekall in a virtual" 81 print " environment. This configuration is not supported!!!" 82 print " Expect breakage." 83 print "*****************************************************" 84 85 if int(setuptools.__version__.split(".")[0]) < 8: 86 raise RuntimeError("Rekall requires at least setuptool version 8.0. " 87 "Please upgrade with 'pip install --upgrade setuptools'") 88 89
90 -class PIPUpgrade(Command):
91 description = "Upgrade all the dependencies in the current virtualenv." 92 user_options = [] 93
94 - def initialize_options(self):
95 pass
96
97 - def finalize_options(self):
98 pass
99
100 - def run(self):
101 required = [x.split()[0] for x in install_requires] 102 output = subprocess.check_output( 103 ["pip", "install", "--upgrade"] + required) 104 105 # Print the current versions. 106 output = subprocess.check_output( 107 ["pip", "freeze"]) 108 109 result = [] 110 for package in required: 111 try: 112 result.append( 113 [x for x in output.splitlines() 114 if package in x][0]) 115 except IndexError: 116 pass 117 118 print "\n".join(sorted(result))
119 120
121 -class CleanCommand(Command):
122 description = ("custom clean command that forcefully removes " 123 "dist/build directories") 124 user_options = [] 125
126 - def initialize_options(self):
127 self.cwd = None
128
129 - def finalize_options(self):
130 self.cwd = os.getcwd()
131
132 - def run(self):
133 if os.getcwd() != self.cwd: 134 raise RuntimeError('Must be in package root: %s' % self.cwd) 135 136 os.system('rm -rf ./build ./dist')
137 138 139 commands = {} 140 commands["pip_upgrade"] = PIPUpgrade 141 commands["clean"] = CleanCommand 142 143 setup( 144 name="rekall-core", 145 version=VERSION["pep440"], 146 cmdclass=commands, 147 description=rekall_description, 148 long_description=open(os.path.join(current_directory, "README.rst")).read(), 149 license="GPL", 150 url="https://www.rekall-forensic.com/", 151 author="The Rekall team", 152 author_email="rekall-discuss@googlegroups.com", 153 classifiers=[ 154 "Development Status :: 4 - Beta", 155 "Environment :: Console", 156 "Operating System :: OS Independent", 157 "Programming Language :: Python", 158 ], 159 scripts=["rekall/rekal.py"], 160 package_dir={'rekall': 'rekall'}, 161 packages=find_packages('.'), 162 data_files=find_data_files("resources"), 163 164 entry_points=""" 165 [rekall.plugins] 166 plugins=rekall.plugins 167 168 [console_scripts] 169 rekal = rekall.rekal:main 170 rekall = rekall.rekal:main 171 """, 172 install_requires=install_requires, 173 extras_require={ 174 # The following requirements are needed in Windows. 175 ':sys_platform=="win32"': [ 176 "pypiwin32==219", 177 ], 178 } 179 ) 180