@@ -33,23 +33,23 @@ class DPKGControlWriter(interface.DependencyFileWriter):
3333 'Standards-Version: 4.1.4' ,
3434 'X-Python3-Version: >= 3.6' ,
3535 'Homepage: {homepage_url:s}' ,
36- '' ] # yapf: disable
36+ '' ]
3737
3838 _DATA_PACKAGE = [
3939 'Package: {project_name:s}-data' ,
4040 'Architecture: all' ,
4141 'Depends: ${{misc:Depends}}' ,
4242 'Description: Data files for {name_description:s}' ,
4343 '{description_long:s}' ,
44- '' ] # yapf: disable
44+ '' ]
4545
4646 _PYTHON3_PACKAGE = [
4747 'Package: python3-{python_module_name:s}' ,
4848 'Architecture: all' ,
4949 'Depends: {python3_dependencies:s}${{misc:Depends}}' ,
5050 'Description: Python 3 module of {python_module_description:s}' ,
5151 '{description_long:s}' ,
52- '' ] # yapf: disable
52+ '' ]
5353
5454 _TOOLS_PACKAGE = [
5555 'Package: {project_name:s}-tools' ,
@@ -58,7 +58,7 @@ class DPKGControlWriter(interface.DependencyFileWriter):
5858 '${{misc:Depends}}' ),
5959 'Description: {tools_description:s}' ,
6060 '{tool_description_long:s}' ,
61- '' ] # yapf: disable
61+ '' ]
6262
6363 def Write (self ):
6464 """Writes a dpkg control file."""
@@ -91,11 +91,10 @@ def Write(self):
9191 [' {0:s}' .format (line ) for line in tool_description_long .split ('\n ' )])
9292
9393 file_content = []
94-
9594 file_content .extend (self ._PYTHON3_FILE_HEADER )
9695
9796 data_dependency = ''
98- if os . path . isdir ( 'data ' ):
97+ if self . _project_definition . name in ( 'artifacts' , 'plaso ' ):
9998 data_dependency = '{0:s}-data (>= ${{binary:Version}})' .format (
10099 self ._project_definition .name )
101100
@@ -153,7 +152,7 @@ class DPKGRulesWriter(interface.DependencyFileWriter):
153152
154153 PATH = os .path .join ('config' , 'dpkg' , 'rules' )
155154
156- _FILE_CONTENT = [
155+ _HEADER = [
157156 '#!/usr/bin/make -f' ,
158157 '' ,
159158 '%:' ,
@@ -164,12 +163,30 @@ class DPKGRulesWriter(interface.DependencyFileWriter):
164163 '' ,
165164 '' ]
166165
166+ _DATA_PACKAGE = [
167+ '.PHONY: override_dh_auto_install' ,
168+ 'override_dh_auto_install:' ,
169+ '\t dh_auto_install' ,
170+ '\t mkdir -p debian/tmp/usr/share/{project_name:s}' ,
171+ ('\t mv debian/tmp/usr/lib/python*/dist-packages/{project_name:s}/data/* '
172+ 'debian/tmp/usr/share/{project_name:s}' ),
173+ '\t rmdir debian/tmp/usr/lib/python*/dist-packages/{project_name:s}/data' ,
174+ '\t find debian/tmp/usr/bin/ -type f -exec mv {{}} {{}}.py \\ ;' ,
175+ '' ,
176+ '' ]
177+
167178 def Write (self ):
168179 """Writes a dpkg control file."""
169180 template_mappings = {
170181 'project_name' : self ._project_definition .name }
171182
172- file_content = '\n ' .join (self ._FILE_CONTENT )
183+ file_content = []
184+ file_content .extend (self ._HEADER )
185+
186+ if self ._project_definition .name in ('artifacts' , 'plaso' ):
187+ file_content .extend (self ._DATA_PACKAGE )
188+
189+ file_content = '\n ' .join (file_content )
173190 file_content = file_content .format (** template_mappings )
174191
175192 with open (self .PATH , 'w' , encoding = 'utf-8' ) as file_object :
0 commit comments