| 
									
										
										
										
											2015-11-17 20:49:10 +08:00
										 |  |  | require "dependency_collector" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DependencyCollector | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |   module Compat | 
					
						
							|  |  |  |     # Define the languages that we can handle as external dependencies. | 
					
						
							|  |  |  |     LANGUAGE_MODULES = Set[ | 
					
						
							|  |  |  |       :lua, :lua51, :perl, :python, :python3, :ruby | 
					
						
							|  |  |  |     ].freeze | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |     def parse_string_spec(spec, tags) | 
					
						
							|  |  |  |       if (tag = tags.first) && LANGUAGE_MODULES.include?(tag) | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         odisabled "'depends_on ... => #{tag.inspect}'" | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if tags.include?(:run) | 
					
						
							|  |  |  |         odeprecated "'depends_on ... => :run'" | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |       super | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |     def parse_symbol_spec(spec, tags) | 
					
						
							|  |  |  |       case spec | 
					
						
							|  |  |  |       when :clt | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         odisabled "'depends_on :clt'" | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :tex | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         odisabled "'depends_on :tex'" | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :libltdl | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "libtool") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :apr | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "apr-util") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :fortran | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "gcc") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :gpg | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "gnupg") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :hg | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "mercurial") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :mpi | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "open-mpi") | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       when :python, :python2 | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "python@2") | 
					
						
							| 
									
										
										
										
											2018-03-03 09:42:25 +00:00
										 |  |  |       when :python3 | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |         output_disabled(spec, "python") | 
					
						
							|  |  |  |       when :ant, :autoconf, :automake, :bsdmake, :cairo, :emacs, :expat, | 
					
						
							|  |  |  |            :fontconfig, :freetype, :libtool, :libpng, :mysql, :perl, :pixman, | 
					
						
							|  |  |  |            :postgresql, :rbenv, :ruby | 
					
						
							|  |  |  |         output_disabled(spec) | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |       else | 
					
						
							|  |  |  |         super | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2017-12-23 16:38:06 +00:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |     private | 
					
						
							| 
									
										
										
										
											2015-11-17 20:49:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-25 10:11:24 +01:00
										 |  |  |     def output_disabled(dependency, new_dependency = dependency) | 
					
						
							|  |  |  |       odisabled "'depends_on :#{dependency}'", | 
					
						
							|  |  |  |                 "'depends_on \"#{new_dependency}\"'" | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2015-11-16 23:18:31 +08:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-07-16 22:14:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-18 20:54:21 +00:00
										 |  |  |   prepend Compat | 
					
						
							| 
									
										
										
										
											2015-11-16 23:18:31 +08:00
										 |  |  | end |